|
It does not seem to be possible with CPen... anyone knows of an alternative? Could not find an article here with an alternative to CPen...
Any ideas?
Thanks
|
|
|
|
|
Will
int nWidth = 3;<br />
ExtCreatePen(..., PS_DOT, ..., nWidth, ...);
work?
|
|
|
|
|
It did the trick!
Thanks a lot! I had not RTFM for long and never realised that CPen had another constructor.
|
|
|
|
|
I learnt from a book how to create a database by creating a new wizard app SDI with ODBC support, but is there a way which i can incorporate a database into an already made SDI(without ODBC support)? coz i only realise i need a data base for my GUI after I did the SDI..thanx
|
|
|
|
|
first
#include "afxdb.h"
in your stdafx.h file
then simply add the CRecordSet Classes into your code with the ClassWizard
|
|
|
|
|
erm...I tried to add the CRecordSet classes but which base class should it b based on? Mi not veri familiar to c++ but need to do a project.
|
|
|
|
|
Hi all,
I want to write a serial and parallel device driver for Windows 2000. Does anyone of any good books on the market.
Thanks
Louis
|
|
|
|
|
I'll let you be the judge as to its goodness or relevance, but here is one:
http://www.flounder.com/books.htm#Developing%20Windows%20NT%204.0%20Device%20Drivers
|
|
|
|
|
I have an Icon resource containing a 16x16 icon and a 32x32 icon.
When I use :
<br />
DrawIconEx(dc, 0, 0, icon, 16, 16, 0, 0, DI_NORMAL);<br />
I always get the 32x32 version of the icon scaled into a size of 16x16, instead of getting the 16x16 version.
When I supply the same Icon to a CTreeCtrl's CImageList, it manages to display the correct icon (16x16) on the tree.
How can I force DrawIconEx or any other method to pull out the small version of the icon ?
Thanks
|
|
|
|
|
DrawIconEx() simply renders the icon associated with the icon handle. How this handle was obtained is the real issue here. Did you use LoadIcon() , LoadImage() , or CreateIcon() ?
|
|
|
|
|
Thanks for the explanation
I was using a simple LoadIcon . I now switched to LoadImage with the 'desired size'.
Thanks again
|
|
|
|
|
hi
How to create a win32 static library and export a function?
with VC6 + sp4
thanks.
|
|
|
|
|
VC6 has a project type called 'Win32 Static Library'.
There is no need to export functions from a static library. Just provide a header file with a declaration.
Brad
|
|
|
|
|
I need to use a pointer to function in a generic class.
This is a peace of the code I've written:
// pointer to function declaration
void (*m_pNotifyDataAvailablity)();
// pointer to function assignment
void CMyClass::SetCallback(void(*p_pNotifyDataAvailablityCallback)(void))<br />
{<br />
m_pNotifyDataAvailablity = p_pNotifyDataAvailablityCallback;<br />
}
My problem is the following:
If I call the SetCallback method supplying a global function no problem occurs. When I try to supply a function member of CMyClass class the application doesn't compile and the following message is shown by the compiler:
error C2664: 'SetCallback' : cannot convert parameter 1 from 'void (void)' to 'void (__cdecl *)(void)'
None of the functions with this name in scope match the target type.
Can someone help me ??
Thanks a lot !!!
|
|
|
|
|
The reason this occurs is because the type of your function (the one which is a part of a class) isn't void(*func)(void).
Whenever you want to call a classe's function you need to call it in the context of an object of that class (i.e. supply a 'this' pointer), but when you'll try to call the function you received with SetCallback you won't have any 'this' (should the code would compile, which it doesn't
here's some code to help put you in the right direction:
(btw, this is also usable when you want a classe's function to run in it's own thread
<br />
class MyClass<br />
{<br />
public:<br />
void MyFunc(void);<br />
};<br />
<br />
<br />
void __cdecl worker(void *pVar)<br />
{<br />
((MyClass*)pVar)->MyFunc();<br />
}<br />
<br />
MyClass::MyClass()<br />
{<br />
worker(this);<br />
}<br />
<br />
<br />
What you need to do is seperate handling of global functions and class-contained functions.
I'm trying to understnad from your example what you were trying to do, perhaps you can define an abstract class 'IMyFunc', put a function 'MyFunc' there, then have all the classes you want to have this possible behaviour implement this class/interface and then you can call an external function, suplpy 'this' and have it call the function, or save the 'this' instead of the function pointer...
hmm, this came out abit confusing, perhaps you can elaborate mroe on waht you're trying to do
|
|
|
|
|
You need to change the callback function within the class to be static . You did not show all of the relevant code, so I can only guess as to what you might have.
void (*m_pNotifyDataAvailablity)();
class CMyClass
{
public:
CMyClass(){};
~CMyClass(){};
void SetCallback(void(*p_pNotifyDataAvailablityCallback)(void));
static void SomeCallback( void );
};
void CMyClass::SetCallback(void(*p_pNotifyDataAvailablityCallback)(void))
{
m_pNotifyDataAvailablity = p_pNotifyDataAvailablityCallback;
}
void CMyClass::SomeCallback( void )
{
AfxMessageBox("Howdy!");
}
...
CMyClass mc;
mc.SetCallback(CMyClass::SomeCallback); Otherwise, the compiler has no way of knowing that SomeCallback() is a member of CMyClass since it has no scope resolution operator.
|
|
|
|
|
If you call the SetCallback method supplying a function member of CMyClass class, you must declaring the function pointer as follows:
void (CMyClass::*m_pNotifyDataAvailablity)();
|
|
|
|
|
Hello all
I'm writing a console application in which I have to generate timer event at intervals 1 min,2 min,3 min,4 min and 5 minutes respectively. it's working fine upto 3 minutes interval but whenever I set 4 minutes or 5 minutes interval the timer event is generated immediately. Following is the code I'm using ...
LARGE_INTEGER liDueTime;
liDueTime.QuadPart=-600000000 * 3;// Generatiing timer event at 3 min interval
// Negative values indicate relative time
HANDLE hTimer=CreateWaitableTimer(NULL,TRUE,"WaitTimer");
SetWaitableTimer(hTimer, &liDueTime, 0, NULL, NULL, 0);
If I'm using -600000000 * 4 or 5 then the event is generated immediately. Can anyone help me in this?
Many thanks for your help.
Hari.
|
|
|
|
|
Since 600000000 * 4 is roughly 2^31 (maximum value of signed int ), it sounds like you are being plagued by OVERFLOW.
|
|
|
|
|
Hello David
Thanks for the reply. You're right the value is exceeding the range an integer can hold. But is there any way to solve my problem of setting time intervals.
If any one knows how to solve it, pls help.
Thanks
Hari.
|
|
|
|
|
Set the timer for one minute, and then each time the event is signaled (or the completion routine is called), increment a counter. When the counter is four, you know that four minutes have elapsed.
|
|
|
|
|
Hello David
Thanks for the reply, Using a counter solved the problem
Hari.
|
|
|
|
|
hi!
several days ago,I wrote my program with seh filter function using "_set_se_translator()",the debug version worked well as my expectation that it turned to my own exception filter specified in _set_se_translator() when the exception happened;but the release version did it as if there was no try_catch statement.why?
thanks!
|
|
|
|
|
You need to provide a bit more context about your code.
That said, I ran into something similar which may be the problem you're having. I had code similar to this:
int* pi = NULL;<br />
int i = *pi;
In debug builds, an exception was thrown from my SE handler and caught, but not in release builds. As it turned out, in release builds, the optimiser was correctly removing this code because it had no effect.
Not sure what you're doing, but if it's simple test case like mine, you might want to turn off the optimiser for that block of code:
#pragma optimize("", off)
Brad
|
|
|
|
|
I have a problem.there is a parent dialog, load two modeless dialog through the TAB control attached, only one modeless dialog show real-time,for don't move the modeless dialog in the tab controls,so the modeless dialog has only a Client,has no title bar.
When handle a button 's clicked command message in parent dialog, I want to trig a modeless dialog's button clicked event.So send message to the destination dialog e.g SendMessage(hModelessDialogWnd,WM_COMMAND,(WPARAM)IDC_BUTTONINMODELESS,0,0),but the destination show modeless dialog don't get the mesage and handle it.
1.How to get the handle of modeless dialog,beause the modelsess dialog has no title bar.
2.I attempt many method to get modeless dialog's pointer or handle.but debug it find don't get the modeless dialog's handle.
|
|
|
|