// stdafx.cpp : 只包括标准包含文件的源文件 // QRText.pch 将作为预编译头 // stdafx.obj 将包含预编译类型信息 #include "stdafx.h" HMODULE g_hQRCodeLibrary = NULL; API_GetQRCodeImg g_GetQRCodeImg = NULL; API_ShowQRCodeBitmap g_ShowQRCodeBitmap = NULL; API_ShowQRCodeOnDC g_ShowQRCodeOnDC = NULL; BOOL LoadQRCodeLibrary() { if ( g_hQRCodeLibrary == NULL ) { g_hQRCodeLibrary = ( HMODULE )LoadLibrary(_T("QRCode.dll")); if ( g_hQRCodeLibrary == NULL ) return FALSE; } g_GetQRCodeImg = (API_GetQRCodeImg)GetProcAddress(g_hQRCodeLibrary, "GetQRCodeBitmap"); if ( g_GetQRCodeImg == NULL ) { FreeLibrary(g_hQRCodeLibrary); return FALSE; } g_ShowQRCodeBitmap = (API_ShowQRCodeBitmap)GetProcAddress(g_hQRCodeLibrary, "ShowQRCodeBitmap"); if ( g_ShowQRCodeBitmap == NULL ) { FreeLibrary(g_hQRCodeLibrary); return FALSE; } g_ShowQRCodeOnDC = (API_ShowQRCodeOnDC)GetProcAddress(g_hQRCodeLibrary, "ShowQRCodeOnDC"); if ( g_ShowQRCodeOnDC == NULL ) { FreeLibrary(g_hQRCodeLibrary); return FALSE; } return TRUE; } void showmsg() { AllocConsole(); // 开辟控制台; SetConsoleTitle(_T("lyfz调试输出")); // 设置控制台窗口标题; freopen("CONOUT$", "w+t", stdout); // 重定向输出; freopen("CONIN$", "r+t", stdin); // 重定向输入; HWND hWnd = NULL; again: hWnd = ::FindWindow(NULL, _T("lyfz调试输出")); if( hWnd ) { if (!::SetWindowPos(hWnd, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE)) { printf(_T("前置设置失败\n")); } else { printf(_T("前置设置成功\n")); } } else { goto again; } }