|
Just a suggestion, but are you accounting for the extended key bit (bit 24)?
0x01520001 => Insert (Extended key)
0x00520001 => Num 0 (Insert)
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Ahh.. Yes, of course! I could add that bit for VK_INSERT, VK_DELETE et al. Thanks!
UINT nScanCode = MapVirtualKey(vk, 1);
switch(vk) {
case VK_INSERT:
case VK_DELETE:
...
nScanCode |= extended_bit;
break;
}
TCHAR buf[20] = { 0 };
GetKeyNameText(nScanCode << 16, buf, 19); That ought to work. I have to give it a try tomorrow.
--
...Coca Cola, sometimes war...
|
|
|
|
|
hmmm...
I think I am clueing in onto what you are trying to do. Sounds very interesting. Do you have any plans to encapsulate it into a class and post it as a CP article? :hint: :hint:
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
The entire menu or just the part which grabs the accelerators and turns them into "text"? If it's the latter, sure, I could do that. The former is.. well, too much work than I have currently.
--
...Coca Cola, sometimes war...
|
|
|
|
|
Jörgen Sigvardsson wrote:
just the part which grabs the accelerators and turns them into "text"
Sounds good to me. That way it could be incorporated into any already existing menu class. I look forward to seeing the article
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
If I manage to track down my leaks within a reasonable time frame, I'll have it done by tomorrow.
--
...Coca Cola, sometimes war...
|
|
|
|
|
WTL::CImageList and ::GetIconInfo() got the best of me today. It turned out WTL::CImageList::~CImageList() doesn't free the encapsulated HIMAGELIST , and that ::GetIconInfo() allocate bitmaps which the caller has to free.
On top of that, I tried using a trial version of boundschecker to find the problem quick and easy. Guess what? Boundschecker is a lying and incompetent piece of sh*t software. It reported a bunch of false positives (verified by seeing the debugger stop at break points in destructors of "unfreed" objects), it can't ref count on COM objects (I saw the IPicture->Release() return 0 !), it also never figured out that my image lists were leaking. Tough day at the office.
But I have noticed an odd thing with GDI objects in general. Something which all programs exhibit, and sometimes even more so when themes are turned on. When you open a dialog (any dialog - you can try with the about box for IE to see for yourself), the GDI object count goes up, let's say X + n. Understandable. But when I close the dialog, the count doesn't go down as much as it went up, let's say X + n - m, where m < n. However, if I reopen the dialog, the GDI object count goes up to X + n again, and back to X + n - m when I close it. It seems as if the dialog resource itself is cached in memory somewhere whenever it's been loaded from the resource part of the exe/dll. I wish I had the source code for CreateDialog() , because now I'm really curious
So, anyway, tomorrow I'll be back on track again to finish off my accelerator stuff.
--
...Coca Cola, sometimes war...
|
|
|
|
|
Hi, every one, I got a problem when using the ::GetModuleHandle API, it always fails if I pass in an absolute path, for example, ::GetModuleHandle("c:\\my app\\app.dll"); will fail even though the file "c:\\my app\\app.dll" exists, but if I copy the program into that directory and call ::GetModuleHandle("app"); it succeeds.
Why can't I use an absolute path for the module? Thank you.
|
|
|
|
|
A suspicion I have is that perhaps the module is in several places on your machine.
The one your process is loading is probably not the full path you are testing.
You can try this topic from MSDN: "Enumerating All Modules For a Process" to determine if the module you are loading is actually from the path you suspect. If it is not indeed loaded from that specific path, then the function call will fail.
|
|
|
|
|
I have a dialogbased app.
When i press a button i wanna check if the DirectShow is installed(DX9SDK specs):
IGraphBuilder *pGraph;
HRESULT hr = CoCreateInstance(CLSID_FilterGraph,
NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **) &pGraph);
if(SUCCEEDED(hr)) AfxMessageBox("DirectShow OK");
else AfxMessageBox("DirectShow FAILED");
!!! Every time it failes (Why GOD, Why ???!!!).
The strange part is that if i define a function, it return positive result:
BOOL VerifyDShow(void)
{
IGraphBuilder *pGraph;
HRESULT hr = CoCreateInstance(CLSID_FilterGraph,
NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **) &pGraph);
if(SUCCEEDED(hr)) return TRUE;
else return FALSE;
}
For the rest of the project is important for me that i can freely use "CoCreateInstance", so please if you have any ideea please help me.
Thanks ...
|
|
|
|
|
Folks,
I'm trying to customize the look of the standard scrollbars.
I have first made them flat with InitializeFlatSB and have modified their size and background color with FlatSB_SetScrollProp and flags WSB_PROP_CYHSCROLL and WSB_PROP_HBKGCOLOR. So far so good.
PROBLEM is that the flag WSB_PROP_PALETTE (requiring a HPALETTE struct as new value) does not affect the appearance of the scrollbars despite the function FlatSB_SetScrollProp success. The test code I use is as follows:
<br />
int nNumColors = 20;<br />
LPLOGPALETTE pLogPalette = (LPLOGPALETTE)new BYTE[sizeof(LOGPALETTE) + nNumColors * sizeof(PALETTEENTRY)];<br />
<br />
pLogPalette->palNumEntries = nNumColors;<br />
pLogPalette->palVersion = 0x300;<br />
<br />
for( int i = 0; i < nNumColors; i++ )<br />
{<br />
pLogPalette->palPalEntry[i].peBlue = 100 + ( i * 5 );<br />
pLogPalette->palPalEntry[i].peRed = 0;<br />
pLogPalette->palPalEntry[i].peGreen = 0;<br />
pLogPalette->palPalEntry[i].peFlags = 0;<br />
}<br />
<br />
CPalette pal;<br />
<br />
pal.CreatePalette(pLogPalette);<br />
<br />
BOOL bSuccess = FlatSB_SetScrollProp( this->GetSafeHwnd(), WSB_PROP_PALETTE, (int)(HPALETTE)pal.Detach(), TRUE );<br />
Suggestions?
Be well,
Franc
|
|
|
|
|
I also had same issue... Someone may pls help..
One more issue I found is, when I change BK color of FlatSB to black, it is displayed as black and white checks... I want it to be fully black.. Any suggestion??
|
|
|
|
|
hi this might be a stupid question but im wondering if its possible to have mscv recognize other file extensions as valid source files
for instance im working with .cc files from linux but msvc just treats them like text files and doesnt do any syntax coloring or auto spacing is there a way to make it recognize this file type
i tried to set the files to be opened by mscv but again just treats it like a text file
|
|
|
|
|
You could try editing the value of "Input_Spec" field of this registry key:
HKEY_USERS\S-1-5-21-1844237615-436374069-1343024091-1004\Software\Microsoft\DevStudio\6.0\Build System\Components\Platforms\Win32 (x86)\Tools\32-bit C/C++ Compiler for 80x86
The value on my system is "*.c;*.cpp;*.cxx".
Also see the "FileExtensions" field of this key:
HKEY_USERS\S-1-5-21-1844237615-436374069-1343024091-1004\Software\Microsoft\DevStudio\6.0\Text Editor\Tabs/Language Settings\C/C++
The value on my system is "cpp;cxx;c;h;hxx;hpp;inl;tlh;tli;rc;rc2".
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
it doesnt seeem to work or maybe i need to restart?
|
|
|
|
|
You'd certainly need to restart DevStudio, but I'm not sure that either of these will work. Just a hunch.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Try adding .cc to :
HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Text Editor\Tabs/Language Settings\C/C++\FileExtensions
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Is there any algorithm for comparing two filenames and determining the likelyhood of them being similar?
Something more complex then checking length and seeing how many characters are different in each?
Can I use regex to execute a slightly more than trivial comparison?
How do I print my voice mail?
|
|
|
|
|
You could use the Soundex[^] algorithm to check if the filenames sound similar.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I remember seeing this in FoxPro? Oracle? Cant be sure. But it is a useful thing! Thank you for the link !
Bikram Singh
I believe we should all pay our tax with a smile. I tried - but they wanted cash.
|
|
|
|
|
oh wicked that's cool
Thanks
How do I print my voice mail?
|
|
|
|
|
while( true )
{
cout<<"Send: ";
cin>>szBuffer;
send( client, szBuffer, sizeof(szBuffer), 0 );
if( strcmpi(szBuffer,"exit") == 0 ) break;
}
if szBuffer is something like "Hello world"
then the server recieves the string in two parts
the first being "Hello" and the second being "world"
so i think you get my point, it seems to be breaking the data by spaces and sending each word
it may be appending the space too, (havnt tested)
now i want it to send "Hello world" all at once instead of by each word, i thought about replacing the spaces with something else, but i dont really want to do that
anyone know what i can to do to solve this?
|
|
|
|
|
Take a look at the WSARecvEx routine - it will tell you if the received message is a partial message.
Steve
|
|
|
|
|
Look at the line
send( client, szBuffer, sizeof(szBuffer), 0 );
I presume szBuffer is comething like LPTSTR , LPSTR , TCHAR * or char * , in which case, the sizeof operator will return the size of the pointer, not the buffer. You need to pass in the size of the buffer, or use strlen (may be vulnerable to buffer overflows).
--
Andrew.
|
|
|
|
|
actually, szBuffer is defined as
TCHAR szBuffer[512];
notice its not defined as a pointer,
im not stupid, if it were defined as a pointer then
sizeof(szBuffer) would return 4
but since its not a pointer it should return 512
how did you get that line to show up with a tan background?
i have tried [code]somecode[/code] before it doesnt seem to work
|
|
|
|