Window Handle bei CMainFrame



  • Liebe VC++ - Fans,

    um eine Hardware zu steuern muß ich ein Programm in VC++ 6.0 schreiben. Der hardwarespezifische Befehl:

    UINT PIOInit( hWnd );
    

    verlangt hWnd als Argument. hWnd ist die "Calling window handle. The window handle is stored by the library so that update messages may be sent to all other windows which have called this function."

    Was muß ich nun statt hWnd verwenden, da ich das Fenster mit CMainFrame aufbaue? Oder was muß ich machen, um hWnd verwenden zu können?

    Vielen Dank im voraus und beste Grüße
    Daniel



  • Wenn mich meine Erinnerung nicht täuscht, ist CMainFrame ein Nachkomme von CWnd. Also kannst du dort den geerbten Member m_hWnd verwenden.



  • Super, Danke!

    Allerding kommt jetzt so was:

    MainFrm.obj : error LNK2001: unresolved external symbol __imp__PIOInit@4
    Debug/PTA_Test2.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    Was nun? Liegt das daran, daß die Hardware nicht an ist?



  • Abrikosoph schrieb:

    Super, Danke!

    Allerding kommt jetzt so was:

    MainFrm.obj : error LNK2001: unresolved external symbol __imp__PIOInit@4
    Debug/PTA_Test2.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    Was nun? Liegt das daran, daß die Hardware nicht an ist?

    Ähm denke nicht, dass ist ein Linkerfehler, also findest der irgenetwas nicht, in diesem Fall "__imp__PIOInit@4".
    Was ist das? Wo steht das? Musst du evtl ne extra lib mit dazubinden?



  • er kennt deine Funktion nicht. Hast du die library dem Linker bekannt gemacht?
    Oder wo ist die Funktion zu finden?



  • In der Hilfe zur Hardware steht:

    For C programs, the header file PTAIO32.H should be included. This file contains all the structure definitions and function declarations required to use the PTAIO32.DLL library.

    Ich habe also in díe Datei StdAfx.h folgendes hinein geschrieben:

    #include <PTAIO32.H>

    weiter steht:

    The next step is to link the PTAIO32 library PTAIO32.DLL using the file PTAIO32.LIB.

    Das habe ich nicht gemacht. Wie geht das?

    Danke und Gruß
    Daniel



  • Projekt->Einstellungen->Linker dort bei Objekt-/Bibliotheksmodule den (relativen) Pfad der Lib reinhauen, wenn sie im Projektverzeichnis liegt reicht der Name der Library.

    Falls die DLL dynamisch gelinkt wird muss diese auch noch mit in den Projektordnern



  • Besten Dank! Das funktioniert jetzt. Allerdings kommen beim Debuggen (Programm geht nicht) wieder lauter andere Fehler:

    ________________________________________________________________________________
    Loaded symbols for 'C:\Programme\Microsoft Visual Studio\MyProjects\PTA_Test2\Debug\PTA_Test2.exe'
    Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\pTAIO32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\PlxApi.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
    Loaded symbols for 'C:\WINDOWS\system32\MFC42D.DLL'
    Loaded symbols for 'C:\WINDOWS\system32\MSVCRTD.DLL'
    Loaded 'C:\WINDOWS\system32\mfc42loc.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\msctf.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\oleaut32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found.
    The thread 0x4AC has exited with code 0 (0x0).
    The thread 0xAB0 has exited with code -2147483645 (0x80000003).
    The program 'C:\Programme\Microsoft Visual Studio\MyProjects\PTA_Test2\Debug\PTA_Test2.exe' has exited with code -2147483645 (0x80000003).
    ________________________________________________________________________________

    Daraufhin findet sich in der MSDN (http://msdn2.microsoft.com/en-us/library/cy2kta5a.aspx), daß ich einen "symbol server" verwenden soll. Dieser richtet sich angeblich so ein:

    1. Unter dem Debugmenü/Optionen erschein folgendes Menü: http://static.flickr.com/28/38156264_cf9c086cc7_o.jpg

    2. Dann sind irgendwelche Einstellungen zu tätigen.

    Wie komme ich aber in das Debugmenü?



  • Abrikosoph schrieb:

    Besten Dank! Das funktioniert jetzt. Allerdings kommen beim Debuggen (Programm geht nicht) wieder lauter andere Fehler:

    ________________________________________________________________________________
    Loaded symbols for 'C:\Programme\Microsoft Visual Studio\MyProjects\PTA_Test2\Debug\PTA_Test2.exe'
    Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\pTAIO32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\PlxApi.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
    Loaded symbols for 'C:\WINDOWS\system32\MFC42D.DLL'
    Loaded symbols for 'C:\WINDOWS\system32\MSVCRTD.DLL'
    Loaded 'C:\WINDOWS\system32\mfc42loc.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\msctf.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\oleaut32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found.
    The thread 0x4AC has exited with code 0 (0x0).

    Bis hier scheint alles normal zu sein.
    Die nächsten zwei Einträge sind aber nicht ok.

    The thread 0xAB0 has exited with code -2147483645 (0x80000003).
    The program 'C:\Programme\Microsoft Visual Studio\MyProjects\PTA_Test2\Debug\PTA_Test2.exe' has exited with code -2147483645 (0x80000003).

    Hast du noch andere Threads am Laufen und noch nicht richtig beendet?



  • Seid ihr euch ganz sicher das die *.lib da eingetragen werden muss? Ich hatte mal das Problem mit einer Messkarte. Ich mache das immer unter Projekt->Eigenschaften von ...->Linker->Eingabe->zusätzliche Abhängigkeiten. Das muss für Release- und Debugversion getrennt eingestellt werden. Sonst kamen bei mir auch solche Meldungen....



  • Ich habe das jetzt anders gemacht, indem ich momentan dabei bin, ein anderes Messprogramm (das bei uns am Lehrstuhl jemand vor langer Zeit geschrieben hat und was anderes mit anderer Hardware misst) zu modifizieren. Da funktioniert das erstaunlicherweise ohne Fehler.

    Trotzdem vielen herzlichen Dank für eure Hilfen, sie waren, auch wenn ich jetzt einen anderen Weg gehe, nicht umsonst.

    Viele Grüße
    Daniel


Anmelden zum Antworten