Need Help in converting Simple C program to VC 
Author Message
 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, &param, 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:
}



Tue, 08 May 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. NEED TO CONVERT Java to C (a simple file I/O program)

2. Convert a VC++program written in .cpp and .bat to a regular MC++ program

3. Need some help in writing a simple C program

4. Need some help in writing a simple C program

5. Need Help on simple ISAM like program

6. need help in extremely simple c program

7. need help debugging simple c program

8. Need help with c program (convert blocks to meg in quota check)

9. Need some help with tweeking a simple program

10. Help on a simple calculator program which needs Trigo, Arithmethic, log functions..[Apologies for repeat mail]

11. Need help with simple C Program

12. Simple BC+31 program - help needed

 

 
Powered by phpBB® Forum Software