|
How do I specify compiler options in the DDK build environments?
I trying to build with /EHsc to enable c++ exceptions...
Thanks for any help.
|
|
|
|
|
Got it:
"USER_C_FLAGS = /EHsc"
in the sources file.
|
|
|
|
|
Be very careful if you are recompiling drivers in the DDK with that flag. They may not be (in fact, probably are NOT) written to handle exceptions. If you're just compiling your own user-mode app from the DDK environment, no worries.
Judy
|
|
|
|
|
Thanks, I'll have to look at that since it's part of a printer driver
|
|
|
|
|
Hi
I injected a DLL into another process. So far, it works fine.
Now I'd like to send messages to the DLL ... I'tried PostMessage but it always returns ERROR_INVALID_THREAD_ID
The code looks like this:
CreateRemoteThread(hProc, NULL, NULL, (LPTHREAD_START_ROUTINE)LoadLibAddy, (LPVOID)RemoteString, NULL, &ThreadId);<br />
<br />
while(!PostThreadMessage(ThreadId, WM_MYMSG, NULL, NULL))<br />
{<br />
if(GetLastError() == ERROR_INVALID_THREAD_ID)<br />
break;<br />
else Sleep(500);<br />
}
and the DLL loops until a message is received (so it loops infinitivly atm )
while(1)<br />
{<br />
if(GetMessage(&msg, NULL, 0, 0))<br />
break;<br />
}
thanks in advance !
|
|
|
|
|
Do any of these potential problems apply?
"GetLastError returns ERROR_INVALID_THREAD_ID if idThread is not a valid thread identifier, or if the thread specified by idThread does not have a message queue."
"Windows 2000/XP: This thread must either belong to the same desktop as the calling thread or to a process with the same locally unique identifier (LUID). Otherwise, the function fails and returns ERROR_INVALID_THREAD_ID."
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Did you find that information hidden in the documentation?
|
|
|
|
|
Extremely well hidden!
I'm pretty sure I find 2% of answers in my code and 97% hidden in the documentation.
The other 1% I pull out of my
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
I had to do this with MMC a few years ago. I used custom messages WM_APP+n where n > 50 and posted them to the main window. My 'injected' Dll, actually a Console plugin installed an application wide Message Hook and filtered out the things it was interested in. Not an elegant solution I know and I hope you don't have to stoop to it. At least you are trying to recieve messages on your own thread not relying on MS to give your control some runtime.;)
http://msdn2.microsoft.com/en-us/library/ms644959.aspx[^]
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
|
|
|
That's true, although I tend to disagree.
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
What was his question & reply?
|
|
|
|
|
read the title (if it appeared you were too dumb to miss it)
|
|
|
|
|
This is the user who normally just types jibberish and has nothing better to do.
______________________
stuff + cats = awesome
|
|
|
|
|
Do you know suchon_phuong ?
|
|
|
|
|
I recognize the name. If you look at the users posts they are mostly gibberish or the most general questions in programming. I have a few people whose names tend to pop out for bad behavior, such as URGENT all the time.
______________________
stuff + cats = awesome
|
|
|
|
|
You can ask on the correct forum for C# we have a forum on the codeproject.
|
|
|
|
|
Hi,
Whenever we generate a MFC app, it generates standard skeleton and code for storing
options and MRU in the registry in the BOOL CSampleApp::InitInstance()
function.
<br />
SetRegistryKey(_T("SampleApp"));<br />
LoadStdProfileSettings(0);
The above comment suggests that options can be loaded either from INI or registry,
and by default registry is used.
How to activate the use of INI files insted of registry.
I'm using VS2005.
Thanks
--
Why buy the cow when milk is free?
|
|
|
|
|
One INI file is a standard file, you should search the MSDN or here in the CP in order to get more information on how to open, read, write and close files.
I would recommend you to use XML files instead of ini files... but this is only a matter of preferences...
If you would like to go to the XML way you should learn how to use any of the interfaces that are in the market.
Hope this helps.
|
|
|
|
|
You can easily switch to using INI files. The major problem you will have is deciding where to put them - Microsoft discourages writing into any of the C:\Program Files folders, which is where your app will usually be installed. But, once you know where you want it, switching to INI file is easy:
- Construct path to INI file:
BOOL CApp::InitInstance()
{
.
.
.
m_strProfileFilePath = "";
m_strProfileFilePath = GetModulePath();
m_strProfileFilePath += "\\";
m_strProfileFilePath += "MyApp.ini";
- Next we need to clean up MFC's default INI string:
free((void*)m_pszProfileName);
m_pszProfileName = _strdup(m_strProfileFilePath);
- Now we can use the standard profile functions in CWinApp:
WriteProfileString("FilesToAdd", "File001", "CRASH.DMP,Crash Dump,DMP File");
WriteProfileString("FilesToAdd", "File002", "ERRORLOG.TXT,Crash log,Text Document");
WriteProfileString("FilesToAdd", "File003", "MyApp.ini,INI File,Text Document");
.
.
.
|
|
|
|
|
Hi,
I've got a static text box on my dialog, I've renamed the text box which then allows me to access its events. I've added an on click event which has automatically created an 'OnStnClicked' method and added an entry to the message map. However when I run the code the 'OnStnClicked' doesn't get called.
Do I need to add change any of the properties on the text control to allow this method to be called? (Double clicking on the text whilst in design mode takes me to the created method)
TIA,
Andy
|
|
|
|
|
Figured it out, needed to set the 'Notify' property to True.
|
|
|
|
|
You need to set the Notify property to True
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
|
|
|
|