
Need Help in converting Simple C program to VC
Help!!! Below is listed a C program that runs correctly. All it does is
display a file name string sent from Test.VxD...works fine. All I want to
do is change this program to display a message box with the file name string
displayed and then do some minor ACCESS DB management relative to the file
name. Is there an easy way to do this in VC++. I have had alot of c
experience and some c+ (not plus-plus). I am new to VC++ and I am having a
difficult time just trying to create a simple program that works with dialog
boxes, simple database management and one callback function. I have gained
a tremendous amount of respect for those who program in vc++.
I initially tried creating an MFC exe using dialog boxes. I then added the
CRECORDSET class to the application. I then attempted to simply add pieces
of the code below to produce the first phase of the program (simply display
the file name in the dialog box). I could not get the callback function to
work correctly.
Help! and thanks in advance,
David
//
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <winioctl.h>
#define WIN32APP
#include "Test.h"
#undef WIN32APP
HANDLE hDevice;
DWORD WINAPI OpenFileAPC(PVOID param)
{
printf("Opening file: %s\n", param);
DeviceIoControl(hDevice, TEST_RELEASEMEM, ¶m, sizeof(PVOID),0,0,0,0);
return 0;
Quote:
}
void main(int ac, char* av[])
{
PVOID inBuf;
DWORD RetInfo;
DWORD nBytesReturned;
hDevice = CreateFile("\\\\.\\TEST.VXD", 0,0,0,
CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);
if (hDevice == INVALID_HANDLE_VALUE)
{
fprintf(stderr, "Cannot load VxD, error=%08lx\n",
GetLastError());
exit(1);
Quote:
}
inBuf = OpenFileAPC;
if ( !DeviceIoControl(hDevice, TEST_REGISTER,
&inBuf, sizeof(PVOID),
&RetInfo, sizeof(RetInfo),
&nBytesReturned, NULL) )
{
fprintf(stderr, "Failed to register APC\n");
exit(1);
Quote:
}
printf("press ctrl-C to exit . . .\n");
while (TRUE)
SleepEx(-1, TRUE);
Quote:
}