|
To get rid of the compilation errors, add the following line after declaration of CResult:
static int CResult::foo = 0;
Making foo/GetFoo/SetFoo static is another story. You know that all instances of CResult will share one foo, right?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
oops, typing error: no need for another static. Just this:
int CResult::foo = 0;
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
That's it. Now it's compiling and working without a hitch.
Thanks a lot!
|
|
|
|
|
Hi!
I have a problem enumerating messages in the exe/dll. May be I was so lucky to fail on bug?
Here is what I do (m_IDs defined as CDWordArray):
BOOL CEventSource::Enumerate()
{
m_IDs.RemoveAll();
return (EnumResourceNames(m_hModule,RT_MESSAGETABLE,EnumIDsProc,(LONG)this));
}
BOOL CEventSource::EnumIDsProc(HMODULE hModule,LPCTSTR lpType, LPTSTR lpName, LONG par)
{
CEventSource * pMe;
pMe=(CEventSource *)par;
pMe->m_IDs.Add((DWORD)lpName);
return true;
}
Both functions return true, m_IDs contain the single element =1, doesn't matter, is there such event ID in the file, or not.
To check the whole structure, I've replaced RT_MESSAGETABLE with RT_DIALOG and received the full list of dialog's IDs. So something wrong with messagetable. But what ?
Any help will be greatly appreciated.
Thanks in advance.
Regards,
Gennady
|
|
|
|
|
All messages are stored in one RT_MESSAGETABLE. Have a look on MESSAGE_RESOURCE_DATA and friends.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I suspected something like this. But first, the description of RT_MESSAGETABLE constant (message-table ENTRY) confused me. Second, I cannot discover, how to get the pointer to MESSAGE_RESOURCE_DATA.
And last. If FormatMessage knows the resource structure, why EnumResourceNames doesn't ? If EnumResourceNames knows the structure of all other resources, why it doesn't recognize the message table. Why it is so peculiar.
I guess, you're not the MS representative, so you may interpret the last questions as rhetorical.
Thanks.
Regards,
Gennady
|
|
|
|
|
I cannot discover, how to get the pointer to MESSAGE_RESOURCE_DATA.
LoadResource, then LockResource.
If EnumResourceNames knows the structure of all other resources...
Not sure about that. EnumResourceNames knows about PE file structure and knows how to interpret the resource directory. Note that you can add your own resource formats to a PE file. They're just embedded in the image and are 'raw bytes'; only your app knows how to deal with them.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks.
As I've understand:
FindResource
LoadResource
LockResource
Deal with MESSAGE_RESOURCE_DATA, _BLOCK and _ENTRY
I can't believe that nobody had done it for message table once and forever! Message table is standard and explotable enough to justify this effort.
Thanks once more.
Regards,
Gennady
|
|
|
|
|
Yeah, Find/Load/LockResource works for me with app-defined resource format. I don't think you'll have much trouble with message tables.
Cheers,
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
How can i get the word that has a mouse pointed over it?
(note : Any words that appear on screen, not only on the active window.)
|
|
|
|
|
Hello,
I need to debug an ActiveX Exe. This executable is launched from an NT Service when the service is started. I've got the source code for both executables but can't figure out how to debug them at the same time.
Can anybody help me?
Thanks in advance.
Matthias
|
|
|
|
|
Hmmm... you might try placing DebugBreak calls (or _asm int 3) in both modules. When these get hit, you'll be promted to debug the application.
I'm thinking you might end up with two copies of the debugger running, which could get a bit wonky, but might work.
Definitely safer to experiment with this stuff by starting the service manually rather than automatically - you can really mess up your session with this stuff if you're not careful!
There are other approaches - I'm not _exactly_ sure what you need/want.
|
|
|
|
|
Did you get help with debugging your NT Service. I can help you with this if you still need help.
Matthew
|
|
|
|
|
Hello,
I have a splitter window in my application. Is it possible to forbid user changes to these windows sizes? I don't want the splitter to be moved anywhere.
And the second question. Is it possible to trace splitter in some way and correct its position if user trys to move it further than I want?
Thank you in advance,
Andrei the Adroit
|
|
|
|
|
create a class derived from CSplitterWnd and override OnMouseMove and OnLButtonDown
maXallion "Look for bugs, I hate bugs!" - Warden, The Mummy www.maxallion.de - coded evil & more
|
|
|
|
|
======PhotoShop SDK======
I´ve changed the original sample source code from VB to VC++, and succeeded to start photoshop using but got a problem with make a new document.
No error, just nothing happened!
I guess it may wrong that PSConstants in PhotoShopTypeLibrary have been changed to NumericType Variables.
Because VC++ doesn´t have PSConstants, I had to use long type variables.
ex)phKeyResolution(VB)---> 1383296116(VC++)
Do you have any experiance in this kind of project?
Any help would be greate.
|
|
|
|
|
I am working with a DAO dataset. When I open the recordset with "SELECT * FROM [MyTable] WHERE [MyField] = m_lMyLong", the Database tells me I dont have enough parameters. If I change m_lMyLong to a number i.e. 10664, the recordset opens fine. It just won't accept the variable (which is set and right according to the debugger). Do I need to bracket the variable name with something? All help appreciated.
Richard
|
|
|
|
|
The SQL statement isn't handled by the C++ compiler, it's interpreted at runtime by the database driver. This means you can't use C++ variable names in SQL statements. You should use CString::Format() or sprintf() to insert the value of the variable in the SQL statement before passing it to Open().
|
|
|
|
|
Thanks, I'll give it a try, but the Field I'm filtering is a long. We'll see what happens when I query it with a string. As you can see, I'm real new at this, and can use all the help I can get.
Richard
|
|
|
|
|
I am looking to change the background color of a static text box. Howz it done..?
Thanks,
John
|
|
|
|
|
Have a look at the message WM_CTLCOLOR.
Create a subclass of CStatic and override the WM_CTLCOLOR message. You should get a function afx_msg HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );
Simply set the text colour when nCtlColor = CTLCOLOR_STATIC
|
|
|
|
|
Hello,
Is there a way to implement the OnChange() function for a int member vairable that is defined through a class? I have a int that changes every second like in a count down timer. I need to updateData(TRUE) every second for this int so it reflects the correct value, the only way I know how to do this is through the OnChange() function like you would use with a edit box control.
Thanks,
Rob Jones
|
|
|
|
|
If it happens every second, what's wrong with OnTimer ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I initialize the int's through a OnStartButton funtion.. In OnTimer I am comparing the values of the 2 int's and displaying the count down time. Once I press the start button it initializes the correct int value and the OnTimer displays the correct count down value but when I do a TRACE on the count down int it shows that the int stays the same value as when I first initialized it and it only updates the one time(in trace). I need for the value to be updated every time it changes so when the OnTimer is comparing the two values and they reach a defined value my program executes a event. I was using a edit box to define the inital value of the int but now I'm pulling the value from a CString.
Rob
|
|
|
|
|
Forget all of that stuff I just wrote.. I see what I was doing wrong..
Thanks for the help!
Rob
|
|
|
|