|
|
vector<vector<BYTE> >?
Angle brackets get chopped off when not enclosed in pre tags.
[edit]Even weirder things happen with nested <>[/edit]
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
how to obtain messages that have been posted/sent into a control?
SPY++ only shows messages that the control has sent out, not messages that it receives
help file from spy++
[QUOTE]
P The message was posted to the queue with the PostMessage function. No information is available concerning the ultimate disposition of the message.
S The message was sent with the SendMessage function. This means that the sender doesn’t regain control until the receiver processes and returns the message. The receiver can, therefore, pass a return value back to the sender.
s The message was sent, but security prevents access to the return value.
R Each ‘S’ line has a corresponding ‘R’ (return) line that lists the message return value. Sometimes message calls are nested, which means that one message handler sends another message. [/QUOTE]
|
|
|
|
|
Assuming that you have the source for the control, you can override the DefWindowProc() function and insert whatever message traps you want.
|
|
|
|
|
awah wrote: SPY++ only shows messages that the control has sent out, not messages that it receives
Incorrect. Spy++ shows the messages sent to a control. The 2nd value in the spy display is the window handle of the RECEIVING window. What you can't tell is where the message originated.
Judy
|
|
|
|
|
Dear all
how to do colour image quantization using VC++? who has code snippet? thanks a lot.
zhiyuan li
Li Zhiyuan
27/06/2007
|
|
|
|
|
|
while(getline(passage,nextword,'\n'))
{
int status = 0;
transform(nextword.begin(), nextword.end(), nextword.begin(), (int(*)(int))std::toupper);
int x=nextword.find(test1);
int y=nextword.find(test2);
int z=nextword.find(test3);
if(x!=std::string::npos)
{
status = 1;
}
if(y!=std::string::npos|| z!=std::string::npos)
{
status = 2;
}
string nextword;
ostringstream os(nextword);
string readInWord;
while (os>>readInWord)
{
if (status==0)
++wordCount[readInWord];
else if (status==1)
{
++wordCount[readInWord];
++single[readInWord];
}
else if (status==2)
{
++wordCount[readInWord];
++single[readInWord];
++compound[readInWord];
}
}
}
I am trying hard to get this code to work but seems to be something wrong. I am testing for 3 things and if present I am trying to update certain maps accordingly. I am getting some sort of error on the ostringstream os(nextword) not sure what this is or what it does. Someone put it in my code saying this would fix my problem but I have yet to figure it out.
|
|
|
|
|
andyspartyshop wrote: not sure what this is or what it does
Then why are you using it ? If you search this site for ostringstream, I have an article on it.
You're initialising a stringstream with a string which has not been initialised ( although it will initialise to "" ). What's the point of that ?
The code is pretty messy. At a minimum, change the if/else to a switch block and give x/y/z more meaningful names.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi All,
Can any one tell me how to convert LPRSTR data type to string date type in VC++. I am doing in the following way.
LPTSTR testLpt; // this I am getting from some method
string testStr = string(testLpt);
I am getting type cast error.
Can any tell me how to do this?
Thanks in advance.
Regards,
JK
|
|
|
|
|
Sounds like your LPTSTR is Unicode (wchar_t).
Try a wstring instead.
You also don't need to construct a temporary string and copy it to another string.
You can construct it in one step:
LPTSTR testLpt; // this I am getting from some method
wstring testStr(testLpt);
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
LPTSTR can be either Unicode or not depending on whether UNICODE is defined. Using std::wstring is ok if you are sure LPTSTR is always unicode. But in this case it would be more correct to have LPWSTR. What to do in current case, is to use std::basic_string<TCHAR>:
typedef std::basic_string<TCHAR> tstring;
Now, conversions between LPTSTR and tstring will work regardless of being unicode or not.
--
=====
Arman
|
|
|
|
|
Thanks for the info
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Hi Arman and Mark,
Thanks a lot. Its working fine with wstring for me.There are no compilation errors now.
But I am having one more problem.
I am using text resource file in my VC++ workspace.
I have included *.rc and *.h file. but I am not able to get the handle to resource file. Following is the sample code.
TCHAR sResName[5] = _T("#103");
TCHAR sRestype[12] = _T("MY_RESOURCE");
HRSRC hres = FindResource(NULL, sResName, sRestype);
HGLOBAL hbytes = LoadResource(NULL, hres);
LPVOID pdata = LockResource(hbytes);
LPBYTE sData = (LPBYTE)pdata;
LPTSTR sXml = (LPTSTR)sData;
wstring strXml(sXml);
In the above code i am not getting hres pointer.
The address of hres is null. Do u have any idea why I am not getting the pointer to resource file using FindResource(). I have included the resource file in the header files folder.
Is there any better way of doing the same?
Thanks in advance
JK
|
|
|
|
|
2 reasons I see for FindResource to fail -
1) A resource of type "MY_RESOURCE" with an integer ID of 103 isn't in the exe's resources.
2) The resource isn't compiled/linked into the exe file (since you've used NULL for hModule param)
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Hi Mark,
Thanks for the reply.
I have checked the ID number its correct.
And I have included resource file in the workspace and I have included resource header in my *.cpp.
I could complie successfully. When I debug and see the return type of findresource() it is NULL.
Do u any idea how to fix this.
Thanks in advance.
JK
|
|
|
|
|
It looks like it should work.
Without seeing the resource script I can't imagine.
You could try AfxGetInstanceHandle() instead of NULL for the module handle.
Also make sure the type is a string and not a macro for an integer.
That's all I can think of off hand...
Mark
This episode brought to you by the number 5
|
|
|
|
|
i am very bad in strings and LPTSTR all that crap
so i switched to using the class CString
simply type
CString MyString;
if you want to put something into your Cstring, type
MyString = "this is my string"<br />
if you want to pass your CString into a LPTSTR field, use MyString.GetBuffer()
switch to CString today!
|
|
|
|
|
I want to develop a program with features below :
1. The usb mass storage device should not be recognised by the windows operating system as a removable storage device at all. i.e. in the standard windows explorer the new removable drive should not be visible
2. But my program must recognise it , and must do all user applications like file operations on it
How can this be done , must i write a strong USB Bus filter driver ?
Thank you very much...
|
|
|
|
|
You're describing features of the hardware, it needs somehow to show a non standard interface to Windows, so Windows cannot tell what it is, but your software will know how to interact with it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I need help encrypting a string with Crypto++, RSA encryption. I downloaded it and integrated in my solution.
I have the keys in hex strings. All the samples I found read the keys from files or sign messages (I want to encrypt the string, not sign it).
Thanks
|
|
|
|
|
ErnestoNet wrote: All the samples I found read the keys from files or sign messages (I want to encrypt the string, not sign it).
They hide that information in the documentation[^]
|
|
|
|
|
|
Hi
In which scenarios would COM connection points be preferred to Windows Messaging (like regsisterwindowsmessage,postmessage) ?
Thanks
Rose81
|
|
|
|
|
Rose81 wrote: In which scenarios
Perhaps if you provide the list of "scenarios" we can filter it for you.
|
|
|
|