|
First thing to do is Be Calm. Read some poetry.
Next, declaring a variable does not give errors. Make sure you declare it:
DWORD id;
before CreateThread() function call.
And try Rebuild All from the build menu.
If that does not solve the problem, you can post the error that Visual Studio gives.
this is this.
|
|
|
|
|
C:\Program Files\Microsoft Visual Studio\MyProjects\wordlist\wordlistDlg.cpp(231) : error C2664: 'CreateThread' : cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned long (__stdcall *)(void *)'
None of the functions with this name in scope match the target type
DWORD id;
m_bWorking = TRUE;
m_hThread = CreateThread(NULL,0,Thread,this,CREATE_SUSPENDED,&id);
SetThreadPriority(m_hThread,THREAD_PRIORITY_LOWEST);
ResumeThread(m_hThread);
that was with the build all
ps. i am calm lol
|
|
|
|
|
Did you declare the Thread function in the class?
It should be like this:
static DWORD __stdcall Thread(LPVOID lpVoid);
In the implementation file:
DWORD __stdcall CMyDlg::Thread(LPVOID lpVoid)
{
...
And "CMyDlg" is the name of your dialog class. Change that with the real name.
Hope that helps.
this is this.
|
|
|
|
|
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]
|
|
|
|