// test.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
//#include<stdio.h>
#include<windows.h>
#include <string>
//#include <afx.h>
//#include <atlstr.h>
#include<iostream>
//#include <afxwin.h>  
#include <windef.h>
#include <sstream>

typedef void (_stdcall*lpGetDiskSerialNumber1)(BYTE drive, char* pout, int* poutsize);//_stdcall

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	//MessageBox(0,"diskno=","",0);
 	// TODO: Place code here.
     HINSTANCE hDll; //声明句柄
     //lpUpSTR upstr = NULL; //声明函数指针
	 int il=0;
	 char p[100];
	 //char* p = new char[128];
	 memset(p,0,sizeof(p)/sizeof(char));
	 //SSTREAM ss;  
	 char ils[10];
	 hDll = LoadLibrary("jydisk.dll"); //加载MAX.dll
     if(hDll){
      lpGetDiskSerialNumber1 GetDiskSerialNumber1 = (lpGetDiskSerialNumber1)GetProcAddress(hDll, "GetDiskSerialNumber1"); //获取UpSTR的地址并强制转换
	  char c[2]={"c"};
	  BYTE i=c[0];
    if(GetDiskSerialNumber1)
	{
		
		GetDiskSerialNumber1(i,p,&il);
		//ss << il; //从long型数据输入 
        //ss >>ils; //转换为 string
		//sprintf_s(ils,10,"%d",il);
		itoa(il,ils,10);
		MessageBox(0,p,ils,0);
		//itoa(il,ils,10);
		//cstring   m_str(ils);   
        //printf("diskno=%s\n", p);//测试MaxNum()
		//MessageBox(0,"diskno=","",0);
	}
    else
	{
       //printf("Can\'t find GetDiskSerialNumber1\n");
		MessageBox(0,"Can\'t find GetDiskSerialNumber1","",0);
	 }
	 }
	else{
    //printf("Can\'t find jydisk.dll\n");
		MessageBox(0,"Can\'t find jydisk.dll","",0);
 }
	return 0;
}



