Flash integration in C++



  • gibt es eine möglichkeit per winapi eine flash datei einzubinden?



  • Einfach das OCX-Einbinden...



  • geht das mit visual studio express und wie? bin noch C++ anfänger lerne gerade winapis 😉



  • In C geht alles. Es ist nur eine Frage der Zeit.
    Ich würde hierzu die MFC verwenden und den Dialog-"Designer".

    Wenn Du "www.gidf.de" verwendest, findest Du auch Beispiele, wie dies in C geht.



  • bei der express edition is weder mfc noch atl dabei deswegen wollte ich das per winapi lösen aber ich weiss halt eben nicht wie


  • Mod

    Dann das entsprechende COM Modul mit #import einbinden...



  • ich hoffe ich habs richtig gemacht -.- aber wie verwende ich das jetzt ich hab damit null erfahrung 😞

    #include <windows.h>
    
    #import "..\\system32\\Macromed\\Flash\\flash.ocx"
    


  • Findet sich evtl hier ein passender Artikel: http://www.codeproject.com/KB/COM/ ?



  • hab was gefunden musste den code vereinfachen ansonsten hätte ich ihn net lesen können er is zwar jetz auch alles andere als schön aber egal
    könntet ihr mir helfen den code noch zu vereinfachen bzw ist das mit dem document loading, parsing notwendig oder kann man das anders lösen?

    #include <windows.h>
    #include <exdisp.h>
    #include <mshtmlc.h>
    
    #import  "PROGID:ShockwaveFlash.ShockwaveFlash" no_namespace raw_interfaces_only
    
    typedef HRESULT (WINAPI *LPAtlAxWinInit)   ();
    typedef HRESULT (WINAPI *LPAtlAxGetControl)(HWND hwnd, IUnknown** unk);
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) {
    
        LPAtlAxWinInit AtlAxWinInit3;
    
    	AtlAxWinInit3 = (LPAtlAxWinInit)   GetProcAddress(LoadLibrary("atl"), "AtlAxWinInit"); // Atl.dll v 3.0 is part of the windows
    
        LPAtlAxGetControl AtlAxGetControl3;
    
    	AtlAxGetControl3 = (LPAtlAxGetControl)GetProcAddress(LoadLibrary("atl"), "AtlAxGetControl"); 
    
        MSG    msg;   
    	HRESULT  hr = AtlAxWinInit3(); //<------ hr
        HWND hWnd;
    
    	hWnd = CreateWindow("AtlAxWin", "http://www.xatech.com/web_gear/flash/chat_195.swf",
    						WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 0, 0); 
    
        IUnknown*       unkn;          
    	hr = AtlAxGetControl3(hWnd, &unkn);
        IWebBrowser2*   brow;          
    	hr = unkn->QueryInterface(__uuidof(IWebBrowser2), (void**)&brow);
        IDispatch*      disp;
    
    		while(!brow->get_Document(&disp) && !disp) { 
    			GetMessage(&msg, NULL, 0, 0); 
    			DispatchMessage(&msg); 		
    						}         // Document loading loop
    
        IHTMLDocument2* html;          
    	hr = disp->QueryInterface(__uuidof(IHTMLDocument2), (void**)&html);
        IHTMLElementCollection* elems; 
    	hr = html->get_embeds(&elems); 
    	VARIANT id; VariantInit(&id);
    
    		while(elems && !elems->item(id,id,&disp) && !disp ) { 
    			GetMessage(&msg, NULL, 0, 0); 
    			DispatchMessage(&msg); 
    						} // Document parsing loop
    
        IShockwaveFlash* flash=0;      
    	hr = disp->QueryInterface(__uuidof(IShockwaveFlash), (void**)&flash);
    
        while (GetMessage(&msg, NULL, 0, 0) && flash) { 
            BSTR val, var = L"textfield2.text";  
    		hr = flash->GetVariable(var, &val);  // Set this var/s in flash
    
    		flash->put_FlashVars(L"id=1913106&xc=2336&cn=712066135&gn=Help");
    
            long frame;                
    		hr = flash->CurrentFrame(&frame);  
            DispatchMessage(&msg); 
        }
    };
    

Anmelden zum Antworten