|
In addition to the _anil_'s message, after you obtained a pointer to your dialog in static MyFunc function, you can simply call the dialog's member function you need, for instance:
<br />
UINT classname::MyFunc(LPVOID pParam)<br />
{<br />
classname * const obj;<br />
obj = (classname*)pParam;<br />
obj->DoWork();
return 0;<br />
}
It is probably preferable to declare this function as a static member function, inside your class. In this way, you are able to call DoWork even if it is private.
|
|
|
|
|
Hi,
I have a bitmap which contains a image , i want to change the background color of the Bitmap during runtime..How to get current background color of the bit and how to set new background color to the bitmap.
Thanks in before
James
-- modified at 7:15 Friday 2nd June, 2006
|
|
|
|
|
you can use CImage m;
m.SetPixelRGB
whitesky
|
|
|
|
|
can be more clear please.i did not get you.
|
|
|
|
|
you can use GetPixel(x,y) in the loop like this
R=GetRValue(Image.GetPixel(10,10));
m.SetPixelRGB(10,10,R,120,120);
of course this way isnt good because you need to two loop for x and y and if your picture is 1024x768 its not good.
----------
Another way you can draw your bitmap on the dc and use from graphic functions (for example Graphics)
----------
you can codeproject examples that are helpful
whitesky
|
|
|
|
|
WhiteSky wrote: Another way you can draw your bitmap on the dc
Could you please tell me how to draw the Bitmap on DC?
thanx for the reply anyway...
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
<br />
HDC hdc=CreateCompatibleDC(::GetDC(this->m_hWnd));<br />
HBITMAP hbit=CreateCompatibleBitmap(GetDC()->m_hDC,800,600);<br />
hbit=(HBITMAP)SelectObject(hdc,hbit);<br />
hbit=(HBITMAP)LoadImage(AfxGetInstanceHandle(),"d:\\error.bmp",IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);<br />
<br />
SelectObject(hdc,hbit);<br />
BitBlt(GetDC()->m_hDC,0,0,800,600,hdc,0,0,SRCCOPY);<br />
whitesky
|
|
|
|
|
See i go bit by bit..how do i know the current background color of the Bitmap.I do i know ,what ever color i got from Getpixel is the current color of the Bitmap..and last but not least i am using Vc2005..when i declare CImage image; ERROR :undeclared indentifer CImage..?
|
|
|
|
|
include atlimage
whitesky
|
|
|
|
|
Hello,
Can anybody help me how to distinguish 2 USB audio devices? I have one PCI2USB card (4 ports) and have 4 USB composite (HID + Audio) devices, which can be use which Skype. Anytime I reboot my PC the device name changed, sometimes it is "USB Audio Device", sometimes it is "USB Audio Device 2", sometimes it is "USB Audio Device 3", and sometimes it is "USB Audio Device 4". Anybody know how Windows assign the USB device name? Any naming convention? And finally, how can I get the VendorID/ProductID from the device name? (For example, i want to know if "USB Audio Device 4" is mapped to which vendorID/ProductID?
Thank you in advanced
Best regards,
Dong
|
|
|
|
|
Hi
I hope that you might have known the GUID of your device.
Then you can search for the GUID in registry
[HKYE_LOCAL_MACHINE\SYSTEM\currentcontrolset\control\class]
under this key you will find your GUID key
under your GUID key thir will be one
"MatchingDeviceId" key which stores VID and PID.
Regards
Anil
-- modified at 7:39 Friday 2nd June, 2006
|
|
|
|
|
Anil,
Thanks for quick reply.
Seem that under HKYE_LOCAL_MACHINE\SYSTEM\currentcontrolset\control\class, all USB audio devices have the same name "USB Audio Device". I could not find "USB Audio Device (2)", "USB Audio Device (3)", and so on. But if I open Sound and Audio Devices Properties Dialog, I could see 4 USB Audio Devices "USB Audio Device", "USB Audio Device (2)", "USB Audio Device (3)", "USB Audio Device (4)". I could recognize my USB device is "USB Audio Device (2)". But next reboot, my device may be named as "USB Audio Device (3). So, my previous setting becomes wrong.
Best regards,
Dong
|
|
|
|
|
Hello again
In Unicode build,how to convert a TCHAR array to array of char -s ?
thanks
|
|
|
|
|
|
I thought there might be the API UnicodeToAscii, but not for C++ / MFC ...
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: I thought there might be the API UnicodeToAscii, but not for C++ / MFC ...
There is are classes CW2A , CA2W .
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Nibu thomas wrote: There is are classes CW2A, CA2W.
You forgot to mention that these are ATL macros.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
use WideCharToMultiByte
Amar
|
|
|
|
|
Hi,
My application is running fine , When Active Configuration is Win32Release and Project->Setting are "Use MFC in a Shared DLL"
but it crashes when Active Sonfiguration is same Win32Release but change the Project->Setting to "Use MFC in a Static Library"
it crashes at following code.
m_pListenSock is an object of CSock class which is inherited from CSocket class.
UINTCServerHandler::OnMsgStart(WPARAM wp, LPARAM lp)
{
m_pListenSock = new CSock();
m_pListenSock->Create (200); // It crashes at Create call
m_pListenSock->Listen ();
return 1;
}
Regard
|
|
|
|
|
So have you stepped into the call to Create() to find the offending statement?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Hallo
How can i change the interpretation of a variable.
Example
<br />
int text = 123456;
...<br />
...<br />
THX
Timen
|
|
|
|
|
This should work!!!
<code>
int nText = 12345;
char szText[10];
int nHex =0;
itoa(12345, szText, 10);
nHex = strtol( szText, NULL, 16);
</code>
Regards
Anil
|
|
|
|
|
Either write your own converter (multiply each digit with powers of 16), or convert to string using sprintf and convert back to hex using sscanf.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Steen Krogsgaard wrote: Either write your own converter (multiply each digit with powers of 16), or convert to string using sprintf and convert back to hex using sscanf.
This makes non-sense. A number is neither in decimal, in hexa, or whatever else; it is just a number. Its representation may change but the number will always be the same. You can say 0x14 or 20 or 0b10100, all these three strings represent the same number.
-- modified at 7:23 Friday 2nd June, 2006
Sorry, I misread the thread
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Hallo
1. Well at least it makes sence. cause i have to controll some hardware. To calculate the needed commands the shortes way is to interprete int as Hex bit shift this and the result is the needed command.
Outherwice if you cant see the sence then become a lectural
2. int - char - hex is what i have and this is as fast doing a lot of if else
combinations - well but i need somthing fast - much faster ?!?!
Well the THX
Timen:->
|
|
|
|