|
This is one of the features I plan to add to FooButton[^]. Will let you know when the article is updated.
Meanwhile, you might want to check out (pun intended) some of the other owner drawn buttons here[^].
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
I'm a beginner but I tried to figure it out for you. The following code doesn't work, but it's what I came up with, and maybe it will give you some ideas. I have a simple dialog box with a few controls and I added this function to the Dialog class(CCodeProject_Dialog2Dlg):
HBRUSH CCodeProject_Dialog2Dlg::OnCtlColor(CDC *pDC, CWnd *pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(pWnd->GetDlgCtrlID() == IDC_WIN98)
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkMode(TRANSPARENT);
}
return hbr;
}
How did you set the background color?
I can't believe the previous poster wouldn't help you. I clicked on the link he posted, and any of the author's of those button programs should be able to tell you how to do that.
Also, what's up with a programming forum that doesn't allow you to post indented code?
|
|
|
|
|
Is there anyone that has experiences with embedding WMF files to PDF without converting it to a raster image format?
Best regards,
A. Riazi
|
|
|
|
|
See the "Other enhancements" section here[^]. Hope this helps.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
This feature is part of another software. I want some source code/tutorial/article about it.
But thanks for your reply.
A. Riazi
|
|
|
|
|
My program has a debug assertion failure and it appears when i close the program the ASEERT failue dialog box is diplayed for a fraction of a second and disappears i am begining to sespect that this is due to the thread i create in my CView constructor in the thread there is an infinte loop and it never exits it postmessages in each second i never worked with THreads is it because the thread associated function never returns a value that i am receving the debug asserion failure ???
;)
|
|
|
|
|
Run the program under the VC++ Debugger and when the ASSERT occures press Retry to go into the debugger. Then look at the Stack Backtrace to find the cause.
Threads should be closed properly by your code. There are several waits to do this. One is to wait on an Event that you signal when your app is closing. Another is to force the thread to raise an exception. See: http://www.codeproject.com/threads/threadlibrary.asp [^] for a good example of this.
I have to wonder why your thread is posting a message once a second and what the thread is being used for. Threads shouldn't be an infinite loop. They should either Wait or Exit when processing is complete.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Neville Franks wrote:
I have to wonder why your thread is posting a message once a second and what the thread is being used for. Threads shouldn't be an infinite loop. They should either Wait or Exit when processing is complete.
First I wanted to make a thread to post a message each second because i was not satisfied with windows timer WM_TIMER messages i wanted to make a timer that is more or less accurate and won't be affected by other messages placed in the queue such as fast mouse cliks or so.
Neville Franks wrote:
Run the program under the VC++ Debugger and when the ASSERT occures press Retry to go into the debugger. Then look at the Stack Backtrace to find the cause.
The main problem is the Dialog box saying i have a debug assertion failure is displayed for a very short time and boom!!! it goes. i could not even see what the error message. let alone to push the button retry, i tired to capture the screen when the dialog box is displayed and it was to fast to do so by pressing the print screen key on the key board.
The debug assertion is caused when i close the window and especially for the first time i boot my comupter and run it from the VC++ editor, after the first build it occurs occasionaly
|
|
|
|
|
leyusha wrote:
Neville Franks wrote:
I have to wonder why your thread is posting a message once a second and what the thread is being used for. Threads shouldn't be an infinite loop. They should either Wait or Exit when processing is complete.
First I wanted to make a thread to post a message each second because i was not satisfied with windows timer WM_TIMER messages i wanted to make a timer that is more or less accurate and won't be affected by other messages placed in the queue such as fast mouse cliks or so.
This makes little sense to me. If your thread is using PostMessage() then you have no better gaurantee of the timer message being received at a specific time than WM_TIMER messages.
leyusha wrote:
The main problem is the Dialog box saying i have a debug assertion failure is displayed for a very short time and boom!!!
I would say you have a serious problem somewhere (not helpfull I know). I'd set a breakpoint in the debugger in the MFC ASSERT code that opens the message box. I'd also have a close look at the thread function. Maybe it is Posting to a Window that no longer exists. Multithreading is a complex area and should be avoided unless you have a very good understanding of how it all works.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Neville Franks wrote:
Maybe it is Posting to a Window that no longer exists
Yeap u are right i added a sleep function in the destructor of CView and was able to see the "ASSERT falure dialog box" and saw the file and line number with the assertion failure it seems that the CWnd::PostMessage() first checks to see if the CWnd is valid and hey it fails there.
Thanks a lot (now i have added a volatile bool variable to exit loop and a check to see if the CWnd is valid before posting a message and if not to exit loop)
|
|
|
|
|
Is there any function to draw draw a line with GDI? I can't seem it..:S
|
|
|
|
|
|
yeah i saw that function but it only lets me set 1 point.. not 2:s...
|
|
|
|
|
|
Thank you very much
|
|
|
|
|
I wanna make a standalone audio visualization. For that i would need the waveform or the amplitude of samples of the audio being played.
Is there ne way in which i can get the waveform or the amplitudes of samples of the media playing on the computer through stereo mixer and/or line-in??
This is similar to the way sound recorder can record ne audio being played by any application on the computer.
Pls hlp.
--
Nikhil
|
|
|
|
|
i already have a dll i could call up from a vb application but i would want to export multiple functions from the c++ dll. anyone got ideas
thanks
larry_larry
larry_larry
|
|
|
|
|
It is very simple. Just create a regular dll and export as much as functions that you want:
#define DLLEXPORT __declspec(dllexport)
DLLEXPORT int func1()
{
return 0;
}
DLLEXPORT void func2()
{
}
DLLEXPORT void func3()
{
}
A. Riazi
|
|
|
|
|
|
Thanks a milll Riazi. But i am also having problems exporting strings from the dll. the only thing that seems to work is if i put the string value in a
messagebox
CString myString()
{
char exString[10] = "Hellodarling"
AfxMessageBox( exString )
return exString
}
this usually give an error of === bad dll call when i call it up in vb
while the message box will display the exstring... and if i change the definition of exstring to == CString exstring it also give an error...
what do think
larry_larry
|
|
|
|
|
Strings in VB are differ from VC. Use BSTR instead of CString .
A. Riazi
|
|
|
|
|
BSTR sTittle()
{
CString s = _T("dllretval");
double d = atof (s);
return s;
}
error C2440: 'return' : cannot convert from 'class CString' to 'unsigned short *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.
BSTR sTittle()
{
BSTR s = "dllretval";
return s;
}
error C2440: 'initializing' : cannot convert from 'char [9]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
larry_larry
|
|
|
|
|
I was wondering if anybody could tell me where to find a ports list for controling the ethernet card. That or some code showing how to change the cards mac address? The ports would be better.
in ports in meen asm ports
out F8,ax
4r3 j00 L33+
|
|
|
|
|
I think you can't change the MAC address of a card. The MAC placed on the card by it's manufacturer.
A. Riazi
|
|
|
|
|
sure you can change the mac address....search for it on the web and you'll find applications like SMac which you can use to change the mac address for your ethernet card.
|
|
|
|