|
Hello Tim,
Thanks a lot for the tips with linker.
Those are exactly what I need.
Best regards,
Miguel
|
|
|
|
|
Hello Don,
To dynamically load a device driver in your (win32 USER-MODE) application, you would use the CreateFile() API. For example :
hDriver = CreateFile
(
"\\\\.\\Omron",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
0, // Default security
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED, // Perform asynchronous I/O
0
);
Notice that the format of the first parameter. A device driver is named using the convention "\\.\<Device name>".
You can get the list of names of devices when you look up the Control Panel's Services applet.
After a successful call to the CreateFile() API, you will be returned a handle to the device driver (hDriver as in the above example). You communicate with the device driver via the DeviceIoControl() API. For example :
bReturnCode = DeviceIoControl
(
hDriver,
IOCTL_OMRON_WRITE,
&lWriteCode, sizeof(lWriteCode),
&byReturnByte, sizeof(byReturnByte),
&dwBytesReturned,
&ov
);
The second parameter specifies the control code for the operation that the device is supposed to perform. The technical manual (or SDK) for your device should supply your with these information.
The other parameters are for transferring data to and from the device driver. Look up the API documentation for details.
As for compiling a device driver, the traditional way is to install DDK as mentioned by Thomas in his mail.
Hope the above helps, Don.
Best Regards,
Bio.
|
|
|
|
|
Hello Bio,
Thanks a lot for your help,
you bring many light in my project.
Thanks also for pointing to me
difference between USER-MODE and
KERNEL-MODE, I was on a wrong way in my
judgement about my task.
Best regards,
Miguel
|
|
|
|
|
How do i make the VC++ compiler to generate a exe ith a new file version evrytime it compiles
Thanks in advance - Vijay
|
|
|
|
|
Visual C++ won't do it for you, so you need to pick up a macro or add-in which does it every time you build your project. There are a bunch of those here on CodeProject. Take a look at this link: Visual C++ Macro's and Add-Ins and on that page there are a bunch. For instance, here's the URL for one of them: Auto-Incrementing Build Numbers in Visual C++.
Hope that helps!
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
I have a program derived form CMemDC. It can work perfectly in Win98, but it doesn't work in win2k.
What's the problem and how to solve it?
class CMemDC : public CDC
{
private:
CBitmap m_bitmap;
CBitmap* m_oldBitmap;
CDC* m_pDC;
CRect m_rect;
public:
CMemoryDC(CDC* pDC, CRect rcClip) : CDC(), m_oldBitmap(NULL), m_pDC(pDC)
{
CreateCompatibleDC(pDC);
pDC->GetClipBox(&m_rect);
IntersectRect(m_rect, rcClip, m_rect);
m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
m_oldBitmap = SelectObject(&m_bitmap);
SetWindowOrg(m_rect.left, m_rect.top);
}
~CMemoryDC()
{
m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
this, m_rect.left, m_rect.top, SRCCOPY);
SelectObject(m_oldBitmap);
}
CMemoryDC* operator->() { return this; }
operator CMemoryDC*() { return this; }
};
Usage:
{
CWnd * pWnd = GetDlgItem (IDC_MY_PANEL);
CDC * pDC = pWnd->GetDC();
CMemDC MemDC(pDC, m_rcDest);
MemDC.FillSolidRect(&m_rcDest, RGB(255, 255, 255));
MemDC.DrawText("Display here", rectDest, DT_SINGLELINE|DT_NOCLIP|DT_CENTER|DT_VCENTER);
......
pWnd->ReleaseDC(pDC);
}
Windows2000 SP2, VC++ 6.0 SP5
|
|
|
|
|
This has nothing to do with your problem, but why are you implementing operator-> and operator CMemoryDC* ?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Maybe the problem is that you write to window DC after it was released:
pWnd->ReleaseDC(pDC);
// now destructor CMemoryDC executes BitBlt
|
|
|
|
|
Thank you vrey much!
I have solved it!
|
|
|
|
|
How to set minimal dialog size (width and height) ?
NodeX
|
|
|
|
|
|
Tomasz Sowinski wrote:
Handle WM_GETMINMAXINFO. Do you have resizable dialog?
Yes I have, thx very much
NodeX
|
|
|
|
|
Is there any way I can snapshot the toolbar layout in the editor, as it seems that I have to reposition them every couple of days, after VC decides to either squash all the toolbars into the left half of the window, or just randomly reorder them.
Is there a single config file or registry entry somewhere which contains the toolbar positions which I could backup, and restore when my toolbars get scrambled? (Or has anyone else already written a tool to do this?)
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
When Visual Studio makes such reposition, I open other instance of VS, close first instance and then second instance. Since VS writes toolbars state when it is closed, I restore by such way the normal state.
|
|
|
|
|
Hello,
I want to know how to copy the highlighted text to the clipboard (like pressing Ctrl+C) in my application using a button. What do I have to do after I map button control? The problem is the highlighted text is not only in my application but it's in the other application. (ex. browser, notepad, etc.)
Help me, please. I have to finish my application within 4 days. Please...
|
|
|
|
|
I don't understand your problem completly,but maybe if you use RichEditView it helps you.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Assuming you have a window handle, you can send the other window a WM_COPY message. Then, in theory, whatever was selected is in the clipboard and you can have a go at it.
The other way to do it, in theory at least, would be to subclass the other app's window, and then use typical CWnd/CEdit functions to get the text (GetSel(), GetWindowText(), that kind of thing).
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Thank you very much.
I've already send WM_COPY message but it doesn't work. There's nothing in the clipboard.
::SendMessage(m_hWnd, WM_COPY, 0, 0);
I don't know why it doesn't work. Did I forget something? Guide me, please.
|
|
|
|
|
IADsNameTranslate *pNto;
hr = CoCreateInstance
(CLSID_NameTranslate,NULL,CLSCTX_INPROC_SERVER,
IID_IADsNameTranslate,(LPVOID *)&pNto);
if(FAILED(hr))
{
.....
}
CoCreateInstance always fail , HRESULT : 800401f0
any ideas ??
thanx
|
|
|
|
|
adara wrote:
LPVOID *)&pNto);
Change it to this:
,(LPVOID **)&pNto);
(two pointer)
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Thanx for your reply , but steel no good
"cannot convert parameter 5 from 'void *** ' to 'void ** '"
|
|
|
|
|
Can't you use smart pointer?It is really better that this kind of using COM.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Call CoInitialize(NULL)
Mustafa Jahangir
BE Computer Systems
NED University
|
|
|
|
|
Hello adara,
HRESULT value of 0x800401F0 means :
"CoInitialize() has not been called."
Make sure that you always call CoInitialize() at the beginning of any
COM application. You can of course call CoInitialize() just before calling
CoCreateInstance().
Note that even after calling CoInitialize() you may still get an error after
the CoCreateInstance() API if there are any other genuine errors.
However, failure to call CoInitialize() will definitely cause other COM APIs
to fail.
Hope the above helps, adara.
Best Regards,
Bio.
|
|
|
|
|
Thank you so much
|
|
|
|
|