|
hello frnds.I am passing some parmtrs frm comndline to MFC exe.If syntax err ocurs ve to display in cmndLine.How to do.I ve tried cout.its not working.
kannan
|
|
|
|
|
Use
system( "pause" );
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
kanna_p wrote: I ve tried cout.its not working.
Why not? What symptoms are you seeing?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: symptoms
I dislike feeling at home when i am abroad. To all the virgins in the world thanks for Nothing
|
|
|
|
|
nothing is happening.Mine is a GUI application.So only AfxMessageBox is working.But I need the msg to be displayed in commandline shell which invoked the application.
|
|
|
|
|
You cannot mix AfxMessageBox() , which is for GUI apps, and cout , which is for console apps.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If your MFC program is a commandline app, you should be given handles to the appropriate output streams. If it is a GUI app, use AfxMessageBox.
earl
|
|
|
|
|
Dear all,
Iam using HWND CreateDialog(HINSTANCE hInstance,LPCTSTR lpTemplate, HWND hWndParent,DLGPROC lpDialogFunc); to create a dialog in DLL, how to get the parameter hInstance is correctly , it must be the dll module's instance..
Manjunath S
GESL
Bangalore
|
|
|
|
|
Manjunath S wrote: how to get the parameter hInstance is correctly ,
GetModuleHandle
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Why aren't you using the value passed to DllMain() ?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all,
I used the hinstance passed in the dll main,And i used it to create dialog model using createdialog . But in that dialog i have static control(having text "driver is loading please wait"),this static text is not displaying . but it display after i returned from that DLL function...
Manjunath S
GESL
Bangalore
|
|
|
|
|
I start threads using AfxBeginThread like :
<br />
AfxBeginThread(myproc,(LPVOID)data);<br />
<br />
UINT myproc(LPVOID lparam)<br />
{<br />
do<br />
{<br />
<br />
}while;<br />
<br />
return(0); ---------> is this enough to close the thread. ? <br />
}<br />
I read if p_AutoDelete in a CWinThread object is set to true(which is it's default) , the thread gets deleted automatically. But I'm not assigning my AfxBegin call to a CWinThread object, But still do you think it'll get deleted automatically? valid suggestions please..
Thanks,
|
|
|
|
|
hi,
I thing here in ur case the thread gets deleted while returning from the thread function
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
Meat Loaf wrote: e thread gets deleted automatically.
that will do
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Yes your thread will go to death automatically. because a thread created with a AfxBeginThread() call in MFC is always a CWinThread .
Happy programming keep asking.
I am the brain behind...
|
|
|
|
|
HELLO,
Now i can read and write all events in any log source (Application,System...)
i can catch each event logging in a specified log source.
the problem is that i want to cach any event in any log source.
this is the proc of catch:
BOOL notifyChange(LPCTSTR logSource)
{
BOOL bSuccess;
HANDLE hEventLog, hEvent;
DWORD dwWaitResult;
hEventLog = OpenEventLog(NULL, // local machine
logSource); // event log source name
if (hEventLog == NULL)
{
printf("Could not open event log.");
return FALSE;
}
hEvent = CreateEvent(NULL, // default security attributes
FALSE, // no manual reset
FALSE, // create as not signaled
NULL); // no event name
NotifyChangeEventLog(hEventLog, hEvent);
dwWaitResult = WaitForSingleObject(hEvent, INFINITE);
if (dwWaitResult == WAIT_FAILED)
bSuccess = FALSE;
else bSuccess = TRUE;
CloseHandle(hEvent);
CloseEventLog(hEventLog);
return bSuccess;
}
|
|
|
|
|
Hello everyone,
I have verified that the following approach works to set the size of a file (newly created file) to be 100 bytes, but I am not sure whether it is the correct/best way to have a maximum portability (I need to write code on both Windows and Linux).
Could anyone give me any comments?
<br />
#include "fcntl.h"<br />
#include "sys/types.h"<br />
#include "sys/stat.h"<br />
#include "io.h"<br />
#include "stdio.h"<br />
<br />
int main()<br />
{<br />
FILE* file = fopen ("foo123", "w+");<br />
<br />
fseek (file, 99, SEEK_SET);<br />
<br />
fprintf (file, "x");<br />
<br />
fclose (file);<br />
<br />
return 0;<br />
}<br />
thanks in advance,
George
-- modified at 6:11 Monday 17th July, 2006
|
|
|
|
|
It's probably a lot more portable than SetEndOfFile() .
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you DavidCrow!
What do you mean SetEndOfFile()? Is there a method called SetEndOfFile() in C?
regards,
George
|
|
|
|
|
George_George wrote: Is there a method called SetEndOfFile() in C?
There's a function called SetEndOfFile().
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you DavidCrow!
Why my method is better than SetEndOfFile()?
regards,
George
|
|
|
|
|
George_George wrote: Why my method is better than SetEndOfFile()?
You wanted portability, didn't you?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you DavidCrow!
Yes, I mean why SetEndOfFile() has worse portability?
regards,
George
|
|
|
|
|
George_George wrote: ...why SetEndOfFile() has worse portability?
It's only for a Windows platform.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you DavidCrow!
regards,
George
|
|
|
|