|
I need your help!!!!
I don't know how use bitmaps with alpha blending under Visual c++
or if i can use it...
Please someone can help me???, i need it... i can load mormal bitmaps but, i need load alpha blended bitmaps into the treeview and toolbars
Please!!!!!
|
|
|
|
|
Hi,
I have a weird problem where if I set a value in HKLM\MS\Windows\CurrentVersion\Run in my code, my app won't be launched. But if I double click on MyApp key, select the value, do a cut-paste of the same string, reboot the computer then it will work!
HKLM\MS\Windows\CurrentVersion\Run
Key: MyApp,
Type: String,
Value: "C:\Program Files\MyApp\MyApp.exe" (quotes are included in the string since there's a space in there).
Here's my code:
<code>TCHAR szPath[MAX_PATH+1];
TCHAR szFullPath[MAX_PATH+1];
UTLGetAppPath( szPath, sizeof( szPath ) );
_tcscat( szPath, NTS_ISMGR_EXE );
memset( szFullPath, 0, sizeof( szFullPath ) );
_tcscpy( szFullPath, "\"" );
_tcscat( szFullPath, szPath );
_tcscat( szFullPath, "\"\0" );
lRes = RegSetValueEx( hKey, NTS_REG_STARTUP_NAME, 0, REG_SZ,
(BYTE*)szFullPath, sizeof( szFullPath ) );</code>
What is wrong???
Thanks!
|
|
|
|
|
You do realize that the Run key is only processed at login, right? Programs don't get run right away when added to the key. (Sorry, silly question, but I had to ask to be sure you understand how the key works.)
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I know! This is how I've tested:
I use InnoSetup for my app and it creates the MyApp key when installing my app. I reboot, everything is fine, app is launched at startup.
Then, I let my code handle the key. First, it deletes the key with RegDeleteValue and then creates (or should I say sets it) it with RegSetValueEx (as shown above).
I then restart Windows and although the key is there (and apparently with the same value), the app won't be launched!
I thought the problem was that I didn't add a null character at the end of the string but it still doesn't work!
|
|
|
|
|
One thing I did notice is that when I set the key through the code, there's '...' at the end of the string! If I set the value manually, the '...' disapears!
|
|
|
|
|
I think I found the solution:
lRes = RegSetValueEx( hKey, NTS_REG_STARTUP_NAME, 0, REG_SZ,
(LPBYTE)szFullPath, _tcslen( szFullPath ) );
Replaced sizeof() with _tcslen()...
|
|
|
|
|
That's almost right, you need to pass the length of the string in bytes, including the final null. So it's:
sizeof(TCHAR) * (1+_tcslen(szFullPath))
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Are you a UNICODE program?
I ask this because you are doing a lot of TCHAR and _tcscpy.
If you are, then be careful when passing sizeof() into functions.
Check the API, see if it wants the buffer size in bytes or characters. If characters, then you should use (sizeof(buf)/sizeof(TCHAR))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
No it's not using UNICODE. It's in bytes, not characters, but I think I found the solution by replacing sizeof() with _tcslen(). Is this safe?
|
|
|
|
|
I'm having trouble sending some data from my SQL database over a socket connection. When I send it, I only receive 4 bytes. I tried memcpying it to a BYTE array but that also only sent 4 bytes. Here is my code:
<br />
CString mySelect;<br />
mySelect.Format("SELECT EMG1_E911_MSG FROM EMG1 WHERE EMG1_DEST_ID = '%s'", thdID);<br />
pCommand.CreateInstance(__uuidof(Command));<br />
pCommand->ActiveConnection = m_pConnection;<br />
pCommand->CommandText = _bstr_t(mySelect);<br />
pRecordset.CreateInstance(__uuidof(Recordset));<br />
pRecordset->CursorLocation = adUseClient;<br />
pRecordset->Open((IDispatch*) pCommand, <br />
vtMissing,<br />
adOpenStatic,<br />
adLockBatchOptimistic,<br />
adCmdUnknown);<br />
_variant_t E911_Msg;<br />
while (!pRecordset->adoEOF)<br />
{<br />
E911_Msg = pRecordset->GetCollect("EMG1_E911_MSG");<br />
if (E911_Msg.vt != VT_NULL)<br />
{<br />
m_sConnectSocket.Send((char*)_bstr_t(E911_Msg), sizeof(1500));<br />
}<br />
pRecordset->MoveNext();<br />
}<br />
I'm not sure it I'm setting something up wrong here. Could someone provide some suggestions.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
sizeof(1500)?
that evaluates to 4
is that what you intended?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
welll.....duh. just testing you. Good job you passed!
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
According the MSDN documentation there are some new advanced gdiplus functions in GDI+ 1.1. Functions like red eye correction:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/GDIPlusreference/classes/redeyecorrection.asp[^]
According the preliminary MSDN documentation the defintions are declared in gdipluseffects.h. However the documentation states: Note: This documentation is preliminary and is subject to change. I tried CodeProject, MSDN, Google and newsgroups. But the only hits I found were others searching for this header.
Has anyone seen these new headers (are they available in Studio 2005 beta?). And are these new functions implemented in the freely distributable gdiplus.dll? Or are these functions only implemented in the version of gdiplus.dll that ships with Office 2003?
Any help appreciated.
Regards Anne Jan
|
|
|
|
|
How would I detec if left mouse button is down in OnMouseMove while other key is down also?
nFlags == MK_LEFT works except if I press right button down also it wouldn't work anymore
I need to create a flag in OnLButtonDown?
|
|
|
|
|
Anonymous wrote:
I need to create a flag in OnLButtonDown?
yes. that's how i always handle it. set a flag when the button is pressed, and flip it when the button is released.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
|
well here is an another suggestion.....(but a longer one)
create a bool variable say "m_clickon"(and initialize it with the value=FALSE) and make it true when ever ur leftbotton os down by using the OnLButtonDown....
make sure u handle thiz variable when the OnlButtonup as well (to set it back to FALSE).....
so whenever u move ur mouse..
the movemove handle is called.....then just check the status of this variable to say wheter the leftbutton is clicked or not...
happy programmin.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
Hi, i wish to use the CxImage libary in my project i am working on. Sadly due to me being a complete muppet and not knowing hardly any visual c++ or knowing how the compiler works properly, i can seem to get the libary to work.
Anyone know a decsent tut on how to use libaries as this would help me a lot.
Thanks a lot
|
|
|
|
|
Hi,
how do I find out how much free store (memory when you call new/delete) is available to my program? If that's not possible how can I tell how much RAM is installed on the machine?
Thanks.
|
|
|
|
|
One way would be to walk the application's heap using the Heap32First() /Heap32Next() pair. You could also use PdhOpenQuery() , PdhMakeCounterPath() and related functions to look at the Memory object. There's also the Win32_PhysicalMemory class.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Wow. I thought there was some simple win32 function that I can just call to get the physical memory size.
The first set of functions looks like it returns the current free-store usage? I wanted to get the limit of the free store. The second set of functions I don't even understand. Finally Win32_PhysicalMemory looks insane. You need to use COM to query some Windows Management Instrumentation (which I don't think I have because none of the MSDN sample code works - missing headers).
I did some more searching and found GlobalMemoryStatus(). This one looked very easy to use and it works on my Win2k machine so far. As long as the computer doesn't have 4G+ of memory I should be covered for now. GlobalMemoryStatusEx() would be ideal but my compiler can't find it.
Thanks for your help.
|
|
|
|
|
Budric B. wrote:
GlobalMemoryStatusEx() would be ideal but my compiler can't find it.
Do you have latest Platform SDK? Also, this is only available under W2K and XP.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Budric B. wrote:
I thought there was some simple win32 function that I can just call to get the physical memory size.
GlobalMemoryStatus() returns that in MEMORYSTATUS::dwTotalPhys , however that doesn't tell you how much memory you can allocate. Virtual memory != physical memory. The amount depends on how much RAM you have, how much swap space is available, and what your process's current VM usage is like. Eg, if you try to allocate 1G of memory, your 2GB process space probably won't have 1G of continuous address space available, so the alloc won't work regardless of how much RAM you have.
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Yes, I figured that was the case. Originally I asked if it was possible to find out how much memory I can allocate. Using the RAM size was something to fall back on. I'll use it to make crude estimations.
|
|
|
|
|
When I create a MSDE database within my application, I call OpenProcess() to open up a Access project file. This project file then starts up form that calls a subroutine. This subroutine needs the variable from my Visual C++ application in order to connect to the newly created database and display the tables. How do I go about doing this? Thanks!
|
|
|
|