|
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.
|
|
|
|
|
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
|
|
|
|