2013-09-29 9 views
0
//#define WIN32_DEFAULT_LIBS 
//#pragma comment(lib, "user32.lib") 
#include <windows.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include <shlwapi.h> 
#include <commctrl.h> 
#include <process.h> 
#include "resource.h" 
#include "../vsrc003_sdk.h" 

volatile int thread_state=0; 
char szWinName[]="MyWin"; 
LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); 
void propo_thread(void *p); 

int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode) 
{ 

HWND hDlg; 
MSG msg ; 
WNDCLASSEX wcl ; 

//InitCommonControls(); 
memset(key_files,0,sizeof(key_files)); 

wcl.hInstance = hThisInst; 
wcl.lpszClassName = szWinName; 
wcl.lpfnWndProc = WindowFunc; 
wcl.style = CS_DBLCLKS; 
wcl.cbSize = sizeof(WNDCLASSEX); 
wcl.hIcon = NULL; 
wcl.hIconSm = NULL; 
wcl.hCursor = LoadCursor(NULL, IDC_ARROW); 
wcl.lpszMenuName = NULL; 
wcl.cbClsExtra = 0; 
wcl.cbWndExtra = 0; 

wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); 

if(!RegisterClassEx(&wcl)) return 0 ; 

hInst = hThisInst; 
hDlg = CreateDialog(hThisInst,(LPCTSTR)IDD_DIALOG1,NULL,DialogFunc); 

while(GetMessage(&msg, NULL, 0, 0)) 
{ 
if(!IsDialogMessage(hDlg, &msg)) { 
    TranslateMessage(&msg); 
    DispatchMessage(&msg); 
} 
} 

VSRC003_ServoPower(0); 
VSRC003_CancelMotion(); 

return msg.wParam ; 

} 

void propo_thread(void *p) 
{ 
int pre_inp=KEYTOTAL-1,i; 
while(thread_state==1) 
{ 
int keyinp=KEYTOTAL-1,getstate=0; 

if(GetKeyState(VK_DELETE) & 0x80){ 
    if(VSRC003_CancelMotion()) thread_state++; 
} 
else if(GetKeyState(VK_ESCAPE) & 0x80){ 
    if(VSRC003_StopMotion()) thread_state++; 
} 

for(i=0;i<KEYTOTAL-1;i++){ 
    if(GetKeyState(chr_keytbl[i]) & 0x80){keyinp=i; break;} 
} 


getstate = VSRC003_GetStatus(); 

if(getstate==ERR_PLAYINGMOTION){ 
    if(keyinp!=pre_inp){ 
     if(VSRC003_StopMotion()) thread_state++; 
    } 
} 

else if(getstate==0){ 
    if(!VSRC003_LoadMotion(key_files[keyinp])){ 
     if(VSRC003_PlayMotion(ENDLESS)) thread_state++; 
     else{ 
      char spath[40]; 

      PathCompactPathEx(spath,key_files[keyinp],40,'\\'); 
      SetDlgItemText((HWND)p,IDC_MOTNAME,spath); 

      pre_inp=keyinp; 
     } 
    } 
    else SetDlgItemText((HWND)p,IDC_MOTNAME,""); 
} 

keyinp=pre_inp; 

{ 
    char str[256]; 
    unsigned short vol; 

    vol = VSRC003_GetValue(VOLTAGE_VALUE); 
    sprintf(str,"%.4fV",(double)vol/1000.0f); 

    SetDlgItemText((HWND)p,IDC_VOLTAGE,str); 
} 

Sleep(0); 
} 

VSRC003_StopMotion(); 
SetDlgItemText((HWND)p,IDC_VOLTAGE,"------------"); 
SendDlgItemMessage((HWND) p,IDC_MODEON,BM_SETCHECK,0,0); 
thread_state=0; 
} 

이 오류 메시지입니다 :오류 LNK2019 : 확인되지 않은 외부 기호 - 비주얼 C++

1>VSRC003_VPROPO.obj : error LNK2019: unresolved external symbol      
[email protected] referenced in function "void __cdecl propo_thread(void *)"   
([email protected]@[email protected]) 

1>.\Debug/VSRC003_VPROPO.exe : fatal error LNK1120: 1 unresolved externals 

사람이 도와 주 시겠어요?

답변

0

라이브러리를 추가 pragma comment(lib,"Shlwapi.lib")

+0

너무 감사합니다 .. 의미가 있습니다! 나는이 문제에 대해 2 주만 낭비한다. :) – DanielH

+0

당신도 역시 오류 메시지가 도움이 될 수있는 구글을 시도해보십시오. – Jichao

관련 문제