|
It's having the problem when the Visual basic DLL attempts to make the call into the VC++ DLL. For some reason this call is not taking place on the Win9x machine, but on the NT/2k machine it works fine.
The visual basic declaration of the VC++ dll function looks like this:
' Declare VC++ DLL function import
Declare Function IndexMsg Lib "OL_Index" Alias "IndexMessage" (ByVal msg_path As String, ByVal msg_note_path As String) As Integer
The actual call to this function looks like:
' Call VC++ DLL function to start the import process
result = IndexMsg((temp_path + MAIL_NAME), (temp_path + MAIL_NOTE_NAME))
On the VC++ side of things, the function declartion looks like:
extern "C" UINT IndexMessage(LPSTR msg_path, LPSTR msg_note_path);
And the implementation like:
extern "C" UINT IndexMessage(LPSTR msg_path, LPSTR msg_note_path)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// debug call to see how far the call goes
AfxMessageBox("Made it into Index func!", MB_OK);
// call the function to perform the indexing tasks
return theApp.DoDisp(CString(msg_path), CString(msg_note_path));
}
And finally my .DEF file for the VC++ DLL exports looks like:
LIBRARY "OL_Index"
DESCRIPTION 'OL_Index Windows Dynamic Link Library'
EXPORTS
; Explicit exports can go here
IndexMessage @59 PRIVATE
|
|
|
|
|
I have been trying to create a CFormView (via Visual C++ 6 AppWizard) that will receive 6 parameter by way of the command line. I want to display each parameter in its own edit box. I have tried several different method of accessing the command line but most give some type of compile error (undefined, etc.). Does anyone have an example and explanation as to how to do this?
Luke Ratliff
|
|
|
|
|
there are dozens of ways to do this.
if you just want the command line parameters, you can use the __argv and __argc variables in you CWinApp::InitInstance the same way you use the argv and argc variables in a standard C program.
there are a number of command line utilities on this site, too. (i know, i wrote one of them)
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Hello,
I was thinking about making a application that pulls CString information from another program I have made and puts the information into a list control.. Where would be the best place to start on something like this?
Thanks,
Rob
|
|
|
|
|
Since you have source for both apps, you may want to use WM_COPYDATA.
|
|
|
|
|
Thanks! Right after you posted that I found this http://www.codeproject.com/threads/ipc_wmcopy.asp
Thanks again!
Rob
|
|
|
|
|
Hi,
I'm a bit clueless here really but I'm sure someone can help me out...
I'm using Chris Maunders MFCGridCtrl class. i want to trap a right click event on a cell. The documentation talks about overriding various "virtual" functions to achieve this.
How do I do this? because not of the grid classes appear in classwizard! I only know how to do this with classwizard.
Thanks
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
A virtual function means you can derive a class from the MFCGridCtrl class, and 'replace' those functions and things will work properly in terms of calls to the base class. So you need to create a new class, derived from the grid control, and then put in your own versions of those functions by hand.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Thanks for your help.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I'm capturing a frame from a video stream. The data is being captured (I've verified that) as a 24-bit image. Part of the data being "captured" is the contents of the BITMAPINFOHEADER struct (again, this struct contains viable data).
I want to take this image and store it to the clipboard as a DIB.
Why doesn't this code work?
BITMAPINFO bmi;
memset(&bmi, 0, sizeof(BITMAPINFO));
bmi.bmiHeader = cb.bih;
HDC hMemDC = CreateCompatibleDC(NULL);
HBITMAP hBitmap = CreateDIBitmap(hMemDC, &bmi.bmiHeader, CBM_INIT, cb.pBuffer, &bmi, DIB_RGB_COLORS);
if (OpenClipboard(NULL))
{
EmptyClipboard();
if (!SetClipboardData(CF_DIB, hBitmap))
{
}
CloseClipboard();
}
It always says that the hBitmap handle is invalid when I try to call SetClipboardData(). The hBitmap isn't NULL.
|
|
|
|
|
try using a real DC (instead of NULL) in your CreateCompatibleDC call. i find that these CreateCompatible things often only work with a real DC.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I tried the CreateCompatibleDC method, and the results are the same.
The SDK documentation says that if you pass NULL to CreateCompatibleDC, you get a screen DC. Why isn't that good enough?
|
|
|
|
|
that might be true..
i only metion that becaseu i find that doing something like this:
CDC memDC;
memDC.CreateCompatibleDC(pRealDC);
CBitmap memBMP;
memBMP.CreateCompatibleBitmap(memDC, ...);
will often fail (i get a monochrome bitmap or something equally perverse). To make it work I have to use pRealDC in the CreateCompatibleBitmap call. using the 'compatible' DC screws things up.
so, as a rule, i always use a real DC (from GetDC(NULL), or a paint DC or a CClientDC) in these functions.
just a thought.
also, when i copy DIBs to the clipboard, i do it like this:
HGLOBAL CISImage::MakeClipboardDIB()
{
HGLOBAL hDIB = MakeDIB();
HGLOBAL hCBDIB = NULL;
if (hDIB)
{
DWORD dwSize = GlobalSize(hDIB);
hCBDIB = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, dwSize);
if (hCBDIB)
{
BYTE *pCBDIB = (BYTE *)GlobalLock(hCBDIB);
memcpy(pCBDIB, (BYTE *)hDIB, dwSize);
GlobalUnlock(hCBDIB);
}
GlobalFree(hDIB);
}
return hCBDIB;
}
...
if (OpenClipboard(AfxGetMainWnd()->m_hWnd))
{
CISImage img;
...put something in img...etc.
HGLOBAL hDib = img.MakeClipboardDIB();
HANDLE res = SetClipboardData(CF_DIB, hDib);
ASSERT(res);
CloseClipboard();
}
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I can't find any reference to MakeDIB except for a MSDN sample app, and it requires parameters.
|
|
|
|
|
yeah. that's my own function. it just creates a typical BITMAPINFOHEADER and image data DIB. i'm assuming you already have a DIB floating around somewhere.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Wel, I have a populated BITMAPINFOHEADER and a shitload of captured bytes...
I've been trying to make a DIB that can be stored to the clipboard. Trouble is, I don't know what I've done right, and what I've done wrong.
Why does something like this have to be so hard in a *graphical* operating system?
|
|
|
|
|
sounds like you've got a DIB. have you tried displaying it (with something like StretchDIBits), just to be sure?
BITMAPINFO *pBMInfo = (LPBITMAPINFO)pDIB ;
LPVOID lpDIBBits = (LPVOID)(pDIB + pBMInfo->bmiHeader.biSize);
UINT32 lines = StretchDIBits(outHDC,
xPos, yPos,
outWidth, outHeight,
0,0,
inWidth,
inHeight,
lpDIBBits,
pBMInfo,
DIB_RGB_COLORS,
SRCCOPY);
that's the easiest way to tell if your DIB is correct/well-formed.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Yup, when I do a StrechDIBits, lines is equal to bmiHeader.biHeight.
|
|
|
|
|
hmmm.. have you tried the clipboard code i posted above?
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
not yet - in the process tho...
|
|
|
|
|
You can't just pass a dib handle to SetClipboardData - that would be too easy. You have to copy the contents into a global memory block and pass the handle of this memory block to SetClipboardData. DIBLOOK sample may be helpful; have a look at CopyHandle helper.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I've already tried the CopyHandle() method, and I get the same results.
|
|
|
|
|
|
Hi,
I have an MCI application that reads/catalogs audio CD's using the CDDB Interface.
There are two things I would like to get it to do that it currently does not;
1) Recognise that a CD has been loaded into the drive, so that I do not need to have a menu item to add a new CD.
2) Eject the drive after the information has been cataloged.
I know that for 2) there are a couple of KB Articles, Q165721 and Q168180, but I would like a simpler, more universal method, if possible.
Many Thanks in advance for any info.
Bryan Anslow.
|
|
|
|
|
Ejecting with MCI is easy. Assuming that you know the drive letter, send the following strings:
"open f: type cdaudio alias cdx0"
"set cdx0 door open"
cdx0 is just a sample alias. Any identifier should work.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|