|
I need to store function pointers with same return type and arguments, but from different classes, in a stl map, like this:
<br />
void(classA::*)(istringstream&)<br />
and
<br />
void(classB::*)(istringstream&)<br />
in the same map (in another class, classC).
is this possible? If so, how is it done?
|
|
|
|
|
|
Does anyone know what determines the LOGFONT values received by the EnumFontFamExProc callback function (for TrueType fonts). At least on my test system, it is not affected by current dpi settings. It's easy to calculate the point size for the values received but I do not appreciate any patterns. For example, some fonts have values that are related to 24 point and others to 12 point.
Are they values embedded in the *.ttf file?...perhaps related to a master glyph size?
|
|
|
|
|
is there a way to format the string?
when I have multiple lines of names like this:
abc defg
abcde fghij
i have been trying to make them line up vertically but couldn't.
Any advice is appreciated
|
|
|
|
|
Maybe try using tab characters (encoded in source using '\t')...
abc\tdefg
abcde\tfghij
You can set the tab width using the
BOOL SetTabStops( int nTabStops, LPINT rgTabStops );
function of CListBox. See MSDN for more.
Best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
A quick fix would be to set the listbox control's font to a monospaced one. You may also want to consider using a CListCtrl.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I guess the title says it all:
If I have a resizable window, how can I make it refuse to resize (that is, the cursor can move but it doesn't change the window size) if a window woulde become too small? I know how to detect the last thing, but not how to stop resizing.
|
|
|
|
|
Handle WM_SIZING and check the lParam value. If the RECT gets too large or small, change it accordingly.
--
Andrew.
|
|
|
|
|
Handle the WM_GETMINMAXINFO message (CWnd::OnGetMinMaxInfo()).
"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!
|
|
|
|
|
Most books tell us how to work with an existing database using Visual C++. Using ODBC or ADO you must set not only database provider, but also a data source. But how can I create new database connecting to different database providers, for example MS SQL Server, MS Access or MySQL?
Salaris
|
|
|
|
|
For MySQL:
m_pDB->Execute("CREATE DATABASE newDatabase;");
m_pDB->Execute("use newDatabase;");
// m_pDB is an CDaoDatabase connection
Ivan Cachicatari
www.latindevelopers.com
|
|
|
|
|
I have used the adox class found at http://www.codeproject.com/database/caaadoxclass.asp[^] to create access databases.
"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!
|
|
|
|
|
Hi again,
>I need to pass to CDaoDatabase::Open(lpszName,
> bExclusive , bReadOnly, lpszConnect) as lpszName
> and lpszConnect ?
You need connect to mysql server, and necessarily select an database. In this one case you can use the data base 'test' installed by default.
To connect use this (need mySQL ODBC 3.51 driver):
CString strConnect = _T("Driver={mySQL ODBC 3.51 Driver};Server=MyRemoteHost;"
"Port=3306;Option=4;Database=MyDatabase;Uid=MyUsername;Pwd=MyPassword;");
m_pDB->Open(NULL,FALSE,FALSE, strConnect);
Ivan Cachicatari
www.latindevelopers.com
|
|
|
|
|
hai,
i am using directx for previewing video from a webcam.but i am not able to store it in my harddisk.how could i do that using directx in vc++.if anybody had done this before,please send the code if possible or give me the guidelines to do so. i am using icapturegraphbuilder2 for previewing the video .if any body can help me ,please help me. my email id is jomuttada@yahoo.com
thank you
jo
Programmer in VB, VC
|
|
|
|
|
I'm trying to translate virtual key codes into strings. I've found that one can translate the virtual key code into a scan code, and then convert the scan code into a string using GetKeyNameText() . GetKeyNameText() works 90% of the time as I'd like. The other 10% confuses the user. For instance, Insert is translated into NUM 0 and Delete into NUM DECIMAL.
I can understand why as scan codes are the "ultimate truth". Since there may be more than one scan code per virtual key (there are two deletes on the keyboard since the AT-model), it has to choose one. I think it chooses the numeric key because of legacy (old XT-keyboards).
Anyway, does anyone know a good way to translate virtual keys into strings? Or do I have to do it manually? ( )
[edit]I think I could specialize the translation for all keys which have doubles. The doubles are those which resides both on the numeric keyboard and the alphanumeric keyboard.[/edit]
(I am going to use the strings in menus to highlight accelerators, if that explains my problem any clearer)
--
...Coca Cola, sometimes war...
|
|
|
|
|
Not that it helps you any, but I think the problem is with your keyboard driver. According to MSDN the driver maintains a list of the key names, and GetKeyNameText gets the names from the driver.
Jörgen Sigvardsson wrote:
For instance, Insert is translated into NUM 0 and Delete into NUM DECIMAL.
On my machine (MS Internet Keyboard, Driver version 5.0.2183.1), Insert is "Insert" and Delete is "Delete". On the number pad, 0 is "Num 0" whether the Num Lock key is on or off, and the . is "Num Del".
I think you could do it manually for your keyboard, but then you will probably run into problems when your users use a different make and/or model of keyboard from what you are using.
"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!
|
|
|
|
|
PJ Arends wrote:
Not that it helps you any, but I think the problem is with your keyboard driver. According to MSDN the driver maintains a list of the key names, and GetKeyNameText gets the names from the driver.
Yeah, provided that I give it the correct scan code. I think the problems lies in that I am reading an accelerator table. In the accelerator table I have virtual key codes only. Since there may be n scan codes for every virtual key code, the keyboard driver/win32 kernel has to guess. I think it just picks an arbitrary scan code which matches the virtual key code. What else could it do?
PJ Arends wrote:
I think you could do it manually for your keyboard, but then you will probably run into problems when your users use a different make and/or model of keyboard from what you are using.
I'm doing both sort of. For every key which there is a 1:1 mapping between "physical" key and "virtual" key, I use GetKeyNameText() on the scan code which MapVirtualKeyEx() gives me. It's smart enough to take my locale into consideration (I have an english version of XP, but it gives me swedish names as that is my locale/regional settings).
For other keys, such as Delete, Insert, et al, which there is an n:1 mapping, I am translating the virtual key code myself rather than the scan code. I think it's weird that the Win32 API doesn't offer (not that I can see anyway) a function to do this for me.
Oh well, the menus are rendering nicely now, without full help from Microsoft.
--
...Coca Cola, sometimes war...
|
|
|
|
|
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.
|
|
|
|