|
im so lost now i have no clue
|
|
|
|
|
Note that CMyDlg is the placeholder of your class-name. e.g, if you made a dialog-based app called Hello, then your dialog class-name will be "CHelloDlg".
When you declare a function, it means go to the header file (*.h), and write the declaration line there:
e.g, in HelloDlg.h:
HANDLE m_hThread;
bool m_bWorking;
static DWORD __stdcall Thread(LPVOID lpVoid);
//------------- declaration ends here.
Now open the associated .cpp file e.g, HelloDlg.cpp and write the complete functions there:
DWORD __stdcall CMyDlg::Thread(LPVOID lpVoid)
{
..... blah blah.
And be sure to read a good book on Visual C++.
this is this.
|
|
|
|
|
yea i know about the CMyDlg name i got it to not give a error when compilling but when run is a bad error but its 6 am im going to bed will post tomorrow
|
|
|
|
|
khan++ wrote:
m_hThread = CreateThread(NULL,0,Thread,this,CREATE_SUSPENDED,&id);
Use AfxBeginThread() with MFC applications.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
See here and here for thread information.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i narrowed it down i think.
if i leave
DWORD id;
m_bWorking = TRUE;
m_hThread = CreateThread(NULL,0,Thread,this,CREATE_SUSPENDED,&id);
SetThreadPriority(m_hThread,THREAD_PRIORITY_LOWEST);
ResumeThread(m_hThread);
like it is it errors if i //ResumeThread(m_hThread);
no error but the program dont run either so im stuck again.
error: debug assertion failed
file: wincore.cpp
line: 890
|
|
|
|
|
locoone wrote:
m_hThread = CreateThread(NULL,0,Thread,this,CREATE_SUSPENDED,&id);
See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i debug my program in VC6.0. when it is closed, the exception "First-chance exception in F863.exe: 0xC0000005: Access Violation." will appear. and the cursor points to m_pInterface->Release().here are some codes:
void _Release() throw()
{
if (m_pInterface != NULL) {
m_pInterface->Release();
}
}
i define the variant:IApplicationPtr m_Application, and i find the exception occured in m_Application->Release().
here are some codes:
int CF863App::ExitInstance()
{
if (m_Application != 0)
m_Application->Release();
return CWinApp::ExitInstance();
}
how can i resolve it?
|
|
|
|
|
Some possible causes:
a) You didn't initialize m_Application to NULL.
b) You are trying to release it more than it's neeeded.
c) Something else
Maybe if you showed where you initialize (or assign) m_Application, and explain what else you do with it...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Any Cpu has a special serial number
How can get it's number in MFC?
|
|
|
|
|
Not any CPU does have one, and it has to be enabled in the BIOS.
E.g. the P3 does have a serial number, but the P4 does not have (see http://download.intel.com/design/Xeon/applnots/24161828.pdf[^], p. 17 ("Processor serial number (PSN) is not supported on the Pentium 4 processor or later."))
If you want to access it refer to section 4.1 of this pdf file.
Don't try it, just do it!
|
|
|
|
|
|
How can i change width and height of a Bitmap and save it again?
|
|
|
|
|
Iam Developing Client/Server Application in MFC Using CSockets.I created Server Socket(Serrived From CSocket) and Created One Thread To Listen to the incoming Requests.In Side that thread iam calling Accept()of CSocket.But my Application is Crashing.can you pls help mw regarding this
VamsiDhar.MBC
SoftwareEngineer
|
|
|
|
|
There are some questions:
1. when your app. crashes?
2. where your application crashes?
3. Which App crashes?(client or server)
You must trace what happening in debug mode in both sides.
|
|
|
|
|
here is my Answers to your question..
My Server Application is crashing when the Application Calls the Thread To start server.
Inside the Thread i called the Accept() methodof server Socket.Then it is Crashing.(It is Crashing becoz it is getting AfxGetInstanceHandle() as NULL).May be the way iam Calling the thread is wrong .
VamsiDhar.MBC
SoftwareEngineer
|
|
|
|
|
normally when i wanted a struct array i would do something like this
typedef struct _TEST
{
char szString[64];
int number;
} TEST;
TEST *t = (TEST*)malloc(sizeof(TEST) * 10));
in which case i would end up with 10 elements in the struct array
but say later, for example when a user adds an item to a list, i need to add another element, is there is there a way to easily do this ?
|
|
|
|
|
|
thank you this is exactly what i needed,
|
|
|
|
|
See my comment about realloc() here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The easiest way is to use std::vector .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
vectors are C++ specifics, and so don't exist in the C language (but i agree, the owner of the thrad didn't precise told us that detail)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Yes it is. However, you need a totally new approach for this. Use a linked list. make a struct for the node like so:
struct node
{
<any datatype=""> variable;
.
.
.
struct node *Link;
};
now make a struct for the linked list like so
struct list
{
node *First //first node in the list.
void InsertNode(node *temp) //inserting at end of list, or anywhwere u like
};
the first node will point to the next node, it will intern point to the next and so on. u can now use malloc to dynamically allocate mem for each node and append them at the end of the chain. remember to always keep the Link of teh last node in the chain as NULL. this is the end of the list. Please see more info on linked lists. There is too much out there for me to explain here, but this is the general format of a SINGLY LINKED LIST, but there many types.
hope this has helped. you can change the functions in the list struct as per your requirements. you may add function for deleting, etc. You cannot create a dynamica array and maintain the data in it at the same time, unless you are using vb, where you can actually do this by ReDim.
I hope i have answered your question )
|
|
|
|
|
actually it seems to work just fine the way i was doing it, and no offense, but i would like a second opinion, before doing this the way you have suggested
|
|
|
|
|
Archer282 wrote:
but i would like a second opinion, before doing this the way you have suggested
Archer, I had this very same question. With the help of a couple of others I started using std::vector. It works very well.
Here is the thread I started Data Storage[^]
Here is an article explaining Vectors[^]
Hope this helps, Good Luck...
-------------------------------
DEBUGGING : Removing the needles from the haystack.
|
|
|
|