|
Hamid has pointed you to a good article - but it doesn't deal with "run time linking" of objects.
This is not a trivial subject, and is a significant part of the reason COM was invented.
In my software, I go a COM-similar way. I have a base class in a H file, with all-pure-virtual methods. I also have a "get me an object of CXXXX type please" C exportable function exported by the DLL. Inside the DLL I have a CImplementXXXX class that I create an instance of and return.
All very COM/CoCreateInstance. All I'm missing is GUIDs.
As to your problem...
Can you solve it by brute force? Writing a second DLL that compile time links to this class (using the approach in the article), and provides a mechannism like I describe above to create an interface to a proxy object within your DLL?
I'm running out of steam, so I'll wish you well.
Iain.
|
|
|
|
|
An example of the Iain's COM -like technique here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I'm now a The? Oooo.
It's a good article you point to - though I think the hack to allow you to access the member functions is a bit too hard and prone to dumb coder mistakes (like I regularly make) for my liking!
It may help him in his reuse of a DLL I bet he has no code access to...
Iain.
|
|
|
|
|
Can someone explain to me how to make a remainder equal the equation for remainder using x and y.
|
|
|
|
|
Sounds like you're after the modulus operator. - %
Code
int x=10, y=7;
printf("x/y = %d, remainder %d\n", x/y, x%y);
Output
x/y = 1, remainder 3
|
|
|
|
|
I have a problem with getting message WM_INPUT for rawinput in MFC. There is no such problem in Win32.
Here is my code.....
My message map:
BEGIN_MESSAGE_MAP(CCEREC_MCDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_MESSAGE(WM_INPUT, GetRawData)
END_MESSAGE_MAP()
In header:
afx_msg LRESULT GetRawData(WPARAM wParam, LPARAM lParam);
Register raw device:
BOOL CCEREC_MCDlg::InitRawDevices(void)
{
Rid.usUsagePage = 0x01;
Rid.usUsage = 0x06; //for keyboard;
Rid.dwFlags = 0;
Rid.hwndTarget = 0;
if (RegisterRawInputDevices(&Rid, 1, sizeof(Rid)) == FALSE)
return false;
else
return true;
}
Function:
LRESULT CCEREC_MCDlg::GetRawData(WPARAM wParam, LPARAM lParam)
{
return 0;
}
|
|
|
|
|
And what is the problem?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
When I press buttons WN_INPUT is not generated. I also tried with mouse and gamepad.
When I use Win32 all work perfectly but I need solution for MFC.
|
|
|
|
|
APahuchiy wrote: Rid.hwndTarget = 0;
How does the system know to send the message to your dialog?
Shouldn't you specify the dialog's HWND there?
I bet the control with focus is receiving the message fine
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
From MSDN
hwndTarget
Handle to the target window. If NULL it follows the keyboard focus.
No Mark, It doesn't work whether or not dialog in focus.
|
|
|
|
|
Right.
You're handling the message in the dialog, which
doesn't get keyboard focus.
Maybe use the dialog window's HWND...
Call the CCEREC_MCDlg::InitRawDevices function from OnInitDialog
(it won't work called from the constructor - you need a valid HWND!).
Then use:
Rid.hwndTarget = *this;
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Many Thanks Mark,
It works fine now!
|
|
|
|
|
Cool!
You're welcome!
Thanks for the update,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
Thanks for the tips on setting hwnd ... I have searched almost an hour to find this anwer ...
|
|
|
|
|
|
Hi !
I would like to create a simple application with C++ Builder which can play an SWF or WMV file (looping) full screen like dynamic desktop.
My problem in which I would like to ask your help :
- How can I set a Form1 to Desktop level ? I mean, how can I set the application form to stay like desktop the very most back of all other windows as well as desktop icons visible, etc ?
I already tried SenToBack() and ZORder(0) but none of the push the application below desktop icons.
Many thanks for your time and help,
Moore
|
|
|
|
|
You can't push the application behind the desktop icons but in front of the actual desktop because the desktop icons and desktop form one window.
If you have Vista, have you tried DreamScene? I believe it has the ability to play WMV files.
Regards,
--Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year." -Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer." -Fred Brooks
|
|
|
|
|
Well, it is not entirely true. E.g visit this site : http://zmatrix.sourceforge.net , download and install it on an XP. you will see thats possible.
I just dont know, how...
Moore
|
|
|
|
|
Hello!
If you know some DirectX/DirectShow you could try creating an overlay for the screen, set the desktop to overlay-color and play the movie file you wish onto the overlay surface. That could work, but you would get ugly results with "shadow" effects like shadowed text under the icons on the desktop.
|
|
|
|
|
Hey everybody
I heard a while ago about an API using WMI that allow me to get notifications of any change of files in the system.
Anyone heard of such API? and if so, anyone can tell me what how it is called?
I looked for it for a while, without much success...
Thanks a lot!
|
|
|
|
|
Not WMI, but there's FindFirstChangeNotification/FindNextChangeNotification.
For WMI, Googling "wmi file event notification" yields a few results.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks 
|
|
|
|
|
|
You could use the api ReadDirectoryChangesW() as well. Check here[^] for code snippet.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi,
I am running a WinCE6.0 Stream interface Driver on a DTE device which will open a handle to Serial port which is
connected to a modem.WriteFile API returns non-zero Value, but NumberofbytesWritten parameters is coming as Zero.
The Windows CE 6.0 device is a DTE terminal and when connected to PC (Another DTE)) over NULL Modem cable with hyperterminal, all the data from the are seen on the hyperterminal, and WriteFile API fills the NumberofbytesWritten is exactly the same as the
bytestoWrite.
When the CE6.0 DTE device is connected to DCE Modemdevice using a Straight serial cable, WriteFile API
is succedding by returning Non-Zero Value, but NumberofbytesWritten parameters is coming as Zero.
The following is the DCB in the driver:
dcb.BaudRate = m_BaudRate;(115200)
dcb.fBinary = TRUE;
dcb.fParity = TRUE;
dcb.fOutxCtsFlow = TRUE;
dcb.fOutxDsrFlow = FALSE;
dcb.fDtrControl = DTR_CONTROL_ENABLE;
dcb.fDsrSensitivity = FALSE;
dcb.fTXContinueOnXoff = TRUE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;
dcb.fErrorChar = FALSE;
dcb.fNull = FALSE;
dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
dcb.fAbortOnError = FALSE;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
Also, I am setting EscapeCommFunction(m_hCOMHandle,SETDTR);
On the hyperteminal I have the following setting:
baudrate = 115200
Data bit = 8
Parity=None
StopBit=1
FlowControl=None
Also, with the same hyperterminal setting with PC(Hyperterminal) connected to Modem over Straight SErial cable,
I am able to fire the AT Commands from the PC(hyperterminal) to the modem.
Also CommTimeout, I have set the following:
CT.ReadIntervalTimeout = MAXDWORD;
CT.ReadTotalTimeoutMultiplier = 0;
CT.ReadTotalTimeoutConstant = 0;
CT.WriteTotalTimeoutMultiplier = 0;
CT.WriteTotalTimeoutConstant = 100;
-Can a timeout issue cause WriteFile Still succeed and Numberof Bytes Written as zero?
- In hyperterminal Flow Control None, what are the Flow control affected in the DCB?
Can somebody give me some hints on the same.
Thanks..
|
|
|
|