|
See, you've confused me now. First you have a linker error, which means that CLSID_ABC was declared in the header, but not defined anywhere. Now you're saying you need to add some code into the header...now, that's not going to help with your linker errors at all.
Rajeesh MP wrote: this is my generated ABC_i.c....
Also - you didn't actually post your ABC_i.c file.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
no dear... i will explain u very simply.....
if i am adding a class to my ATL application...that class id will generate automatically in our ABC_i.h....
but i m trying to add my existing file to my application...After compiling time this existing CLASSID is not generating in our ABC_i.h
so my question after adding this excisting ABC.cpp i need do something in our application settings..for generating this classid..
Regards
Raj
|
|
|
|
|
Rajeesh MP wrote: if i am adding a class to my ATL application...that class id will generate automatically in our ABC_i.h....
Fine - we agree on that
Rajeesh MP wrote: but i m trying to add my existing file to my application...After compiling time this existing CLASSID is not generating in our ABC_i.h
By 'existing file', I presume you mean the IDL file that contains that class and interface definition? Or not?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Good MOrning...Stuart
NO...directly i m adding ABCD.cpp and ABCD.h file
why..there is no other post...??only we are here...ha ha ha
Mr.Staurt ..can u add me on ur personel mail...
my id rajeeshmp@gmail.com
Regards,
Rajeesh MP
modified on Wednesday, April 22, 2009 12:16 AM
|
|
|
|
|
Rajeesh MP wrote: NO...directly i m adding ABCD.cpp and ABCD.h file
OK - finally, I think I'm clear on why you're having these problems
So...let me tell you what I've done and let's see if that helps.
I first created an ActiveX project called "ax-ctrl", with a simple ActiveX object called "test". That built fine. It contained files test.h and test.cpp (for the object) and axctrl_i.c and axctrl_i.h (for the ActiveX library).
I then created another ActiveX project called "ax-copy" and added test.cpp and test.h to that without moving them from the existing project. When I built that project, it complained about missing symbols like this:
3>test.obj : error LNK2001: unresolved external symbol _IID_Itest
3>test.obj : error LNK2001: unresolved external symbol _LIBID_axctrlLib
I then added axctrl_i.c to the ax-copy project and (after telling it not to use precompiled headers) it worked fine.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Ha Ha Ha...
my application is working same way only...
before posting this message...i done this..and its working fine...
but i would like to know any alternate trik is there or not..like adding reference or linking....etc
Thank u Stuart
Rajeesh MP
|
|
|
|
|
Good Morning Mr.Stuart
if i m creating a dll with ATl dotnet2008.
that we can register in regscr 32 /i "dll path"...am i right..???
my old c++ application like this (ABC.cpp)
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_ABCD, CABCD)
END_OBJECT_MAP()
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID )
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, &LIBID_ABCLib);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
_Module.Term();
return TRUE;
}
but now i m converting this to new application with ATL dotnet2008.
so in my dllmain.cpp contains
CABCModule _AtlModule;
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
hInstance;
return _AtlModule.DllMain(dwReason, lpReserved);
}
and ABCD.h contains
OBJECT_ENTRY_AUTO(__uuidof(ABCD), CABCD)
My new ATL appliation is successfully succeeded..
regscr 32 /i "dll path" i can register like this..no error
After registering my AIM is not getting..its not working..
i m feeling this above code conversion is not proper..
so mr.Stuart please check this code and let me know..
Thanks
Rajeesh MP
|
|
|
|
|
Rajeesh MP wrote: so in my dllmain.cpp contains
DllMain doesn't really matter - when regsvr32 registers a control, it calls DllRegisterServer, which you should find in one of your other cpp files.
Rajeesh MP wrote: After registering my AIM is not getting
AIM? As in messaging?
Rajeesh MP wrote: i m feeling this above code conversion is not proper..
If it's ATL generated code, then I'm confident it's OK. The issue is more likely to be with the control registration data (the rgs files). Check that the CLSIDs and paths in those are OK
Then you can open the registry (with regedit) and check that the registration in there is OK.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Rajeesh MP wrote: but i would like to know any alternate trik is there or not..like adding reference or linking
Not really - building the UUID directly into the code is hte best way.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
HI..Stuart
My ATL 2008 application dllmain is contains
CABCModule _AtlModule;
abc.cpp is having
STDAPI DllRegisterServer(void)
{
HRESULT hr = _AtlModule.DllRegisterServer();
return hr;
}
STDAPI DllUnregisterServer(void)
{
HRESULT hr = _AtlModule.DllUnregisterServer();
return hr;
}
but my old application is
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_ABCPP, CABCPP)
END_OBJECT_MAP()
STDAPI DllRegisterServer(void)
{
return _Module.RegisterServer(TRUE);
}
STDAPI DllUnregisterServer(void)
{
return _Module.UnregisterServer(TRUE);
}
any difference is there this two codes..??
what s the difference b/w ...
CABCModule _AtlModule;
and
CComModule _Module;
i think becouse of this my dll is not working properly..
how do i create CComModule _Module; project..in ATL dotnet2008..
Regards
Rajeesh MP
|
|
|
|
|
Rajeesh MP wrote: CABCModule _AtlModule;
and
CComModule _Module
The ATL module classes changed. Not a big deal.
Rajeesh MP wrote: i think becouse of this my dll is not working properly
And why do you think your dll isn't working - what evidence do you have?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
can u send me...ur personel ID...
rajeeshmp@gmail.com
|
|
|
|
|
did you solve it or not? I am into same kind of project and need help.
|
|
|
|
|
I create a COM using the ATL in VS2005,it only include one interface,which contains one property(get/put).in order to debug the COM,I create a C# programe and set a breakpoint in the COM,"The breakpoint will not currently be hit. No symbols have been loaded for this document",why??? thanks!
modified on Thursday, April 16, 2009 9:16 PM
|
|
|
|
|
That's because the C# program doesn't know that it'll be loading your COM DLL - it only loads the DLL at run-time. To debug a COM DLL, I would set the DLL project as your startup project and tell it which executable (i.e. your C# executable) to use in the 'Command' property of the project's 'Debugging' property page.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
I have a link my html page and onclick of that i need to download
and run the msi(ie i need to run a command in client like "msiexec /i http://(servername)/(virtual directory name)/test.msi ALLUSERS=1 /PASSIVE" )
which is present in the webserver(IIS 5 or IIS 6)...(it"s an intranet application)
as of now im using Wshell.Run(vb script) to run msi ...but it works fine only when the option "Initialize and script ActiveX
controls not marked as safe" under Tools\internet
options/Security/Customlevel/ActiveX controls and plugIns ,is set to prompt or enable .....
So i thought of creating my own ActiveX control (signed) with certificate...instead of using Wshell...but im not sure whether
i can achieve this...please help me regarding the same....and correct me if im wrong
modified on Thursday, April 16, 2009 5:30 AM
|
|
|
|
|
Hi guys,
I have two vectors of string
and I'm looking for an easy way to find the first vector sequence or sub-sequence into the first one
for example:
Vect_1 < "JAVA", "ADA", "C", "C++", "C#">
Vect_2 < "C++", "C#">
search vect_2 sequence in vect_1 will return vect_1 position 3 and match length 2
Vect_1 < "JAVA", "ADA", "C", "C++", "C#">
Vect_2 < "JAVA", "C#">
search vect_2 sequence in vect_1 will return vect_1 position 0 and match length 1
thanks for any idea, suggestion
|
|
|
|
|
The simplest algorithm is probably this:
std::pair<size_t, size_t> find_first_subsequence(std::vector<std::string> const& v1,
std::vector<std::string> const& v2)
{
std::vector<std::string>::const_iterator pos = std::find(v1.begin(), v1.end(), v2[0]);
const size_t firstPos = pos-v1.begin();
if (pos == v1.end()) return std::make_pair(-1, -1);
size_t numEqual = 0;
while(numEqual < v2.size() && pos != v1.end() && *pos == v2[numEqual])
{
++numEqual;
++pos;
}
return std::make_pair(firstPos, numEqual);
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Because std::search only returns a match if it finds the whole of a sequence you're looking for, not a partial match, which is what the OP was looking for.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Fair point. I didn't read the OP's post carefully enough.
Steve
|
|
|
|
|
I'm at the end of my rope here... I've been bashing my head on my keyboard for the last week trying to figure out this issue.
I'm trying to display a flash control on a DirectDraw surface and my call to AtlAxAttachControl fails - preventing the flash player from appearing within the control.
Here's a stripped down version of my code:
#pragma once
#include <string>
#include <windows.h>
#include <exdisp.h>
#include <mshtmlc.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
using std::string;
#import "PROGID:ShockwaveFlash.ShockwaveFlash" no_namespace raw_interfaces_only
typedef HRESULT (WINAPI *LPAtlAxWinInit) ();
typedef HRESULT (WINAPI *LPAtlAxGetControl)(HWND hwnd, IUnknown** unk);
class FlashViewer
{
public:
FlashViewer();
~FlashViewer();
bool Init(int Width, int Height);
void OpenFlash(const char* filename);
void DrawToSurface(LPDIRECTDRAWSURFACE7 lpdds);
private:
int mViewerWidth;
int mViewerHeight;
HWND mViewerWnd;
IShockwaveFlash* mFlashCtrl;
};
FlashViewer::FlashViewer()
{
mViewerWidth = 0;
mViewerHeight = 0;
mViewerWnd = 0;
mFlashCtrl = NULL;
}
FlashViewer::~FlashViewer()
{
DestroyWindow(this->mViewerWnd);
if (this->mFlashCtrl != NULL)
{
this->mFlashCtrl->Release();
this->mFlashCtrl = NULL;
}
}
bool FlashViewer::Init(int width, int height)
{
LPAtlAxWinInit AtlAxWinInit3 = (LPAtlAxWinInit)GetProcAddress(LoadLibrary("atl"), "AtlAxWinInit");
LPAtlAxGetControl AtlAxGetControl3 = (LPAtlAxGetControl)GetProcAddress(LoadLibrary("atl"), "AtlAxGetControl");
MSG msg;
HRESULT hr = AtlAxWinInit3();
HWND hwnd = CreateWindow("AtlAxWin", "", WS_VISIBLE|WS_POPUP, 0, 0, 1024, 768, 0, 0, 0, 0);
IShockwaveFlash* flash = 0;
hr = CoCreateInstance(__uuidof(ShockwaveFlash), 0, CLSCTX_ALL, __uuidof(IShockwaveFlash), (void **)&flash);
hr = flash->put_WMode(L"transparent");
hr = flash->put_Loop(true);
hr = AtlAxAttachControl(flash, hwnd, NULL);
hr = flash->put_Movie(L"c:\\FrontEnd.swf");
long pVal = -1;
flash->get_ReadyState(&pVal);
return true;
}
void FlashViewer::OpenFlash(const char *filename)
{
this->mFlashCtrl->LoadMovie(0, _bstr_t(filename));
}
void FlashViewer::DrawToSurface(LPDIRECTDRAWSURFACE7 lpdds)
{
if (this->mViewerWnd == NULL)
return;
RECT rect = {0, 0, this->mViewerWidth, this->mViewerHeight};
HDC hdcSurface;
HRESULT hr = lpdds->GetDC(&hdcSurface);
if (FAILED(hr))
return;
SetMapMode(hdcSurface, MM_TEXT);
OleDraw(this->mFlashCtrl, DVASPECT_CONTENT, hdcSurface, &rect);
lpdds->ReleaseDC(hdcSurface);
}
When debugging - the console displays two First-chance exceptions as soon as AtlAxAttachControl() is called... Both are 0x8001010D: An outgiong call cannot be made since the application is dispatching an input-syncronous call.
This problem is totally driving me crazy... PLEASE SOMEONE HELP.
|
|
|
|
|
I suspect that it's a COM threading issue. Do you have a single threaded app or maybe a single-threaded apartment model app? Is FlashViewer::Init called from within a COM method?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Its a single threaded app but I think you might have something on the apartment model. I'm using this as a control inside a WIN32 window. The odd thing is that the FlashViewer::Init still throws the same error even if its executed before the WIN32 window is declared. The other strange thing is that this code executes if its included on its own like this:
#include <string>
#include <windows.h>
#include <exdisp.h>
#include <mshtmlc.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
using std::string;
#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 inst, HINSTANCE prev, LPSTR cmd, int show)
{
LPAtlAxWinInit AtlAxWinInit3 = (LPAtlAxWinInit)GetProcAddress(LoadLibrary("atl"), "AtlAxWinInit");
LPAtlAxGetControl AtlAxGetControl3 = (LPAtlAxGetControl)GetProcAddress(LoadLibrary("atl"), "AtlAxGetControl");
MSG msg;
HRESULT hr = AtlAxWinInit3();
HWND hwnd = CreateWindow("AtlAxWin", "", WS_VISIBLE|WS_POPUP, 0, 0, 1024, 768, 0, 0, 0, 0);
IShockwaveFlash* flash = 0;
IViewObject* view = 0;
hr = CoCreateInstance(__uuidof(ShockwaveFlash), 0, CLSCTX_ALL, __uuidof(IShockwaveFlash), (void **)&flash);
hr = flash->put_WMode(L"transparent");
hr = flash->put_Loop(true);
hr = AtlAxAttachControl(flash, hwnd, NULL);
hr = flash->put_Movie(L"c:\\FrontEnd.swf");
hr = flash->QueryInterface(__uuidof(IViewObject), (void **) &view);
long pVal = -1;
flash->get_ReadyState(&pVal);
BSTR val = L"Null", var = L"GetLastButton";
string cval;
while(GetMessage(&msg, 0, 0, 0) && flash)
{
hr = flash->CallFunction(L"<invoke name=\"GetLastButton\" returntype=\"string\"></invoke>" , &val);
cval = _com_util::ConvertBSTRToString(val);
if (cval.compare("<string>btnQuit</string>") == 0 )
{
PostMessage(hwnd, WM_QUIT, NULL, NULL);
}
DispatchMessage(&msg);
}
};
I tried using OleInitialize(NULL); at the start of the INIT function which is supposed to call CoInitializeEx with COINIT_APARTMENTTHREADED. But I still got the same problem.
Heres my shell for the windows app (excuse the amount of code):
WIN32APP.H
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#pragma once
#define SCREEN_WIDTH 1024
#define SCREEN_HEIGHT 768
#define COLOR_DEPTH 32
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)
class Win32App
{
public:
Win32App() { };
~Win32App() { };
void Start(HINSTANCE hInst, bool isFullscreen);
char const * Title;
char const * ClassName;
bool isFullscreen;
static HINSTANCE hInst;
static HWND hWnd;
private:
WNDCLASS localWndClass;
static LRESULT CALLBACK WindowsProcedure(HWND hwnd, unsigned int message, WPARAM wParam, LPARAM lParam);
protected:
virtual void PreInitialize() { };
virtual void PostInitialize() { };
virtual void Main() { };
virtual void CleanUp() { };
void StartMessagePump();
void Quit()
{
PostMessage(hWnd, WM_QUIT, 0, 0);
}
};
HINSTANCE Win32App::hInst;
HWND Win32App::hWnd;
void Win32App::Start(HINSTANCE hInst, bool isFullscreen)
{
this->hInst = hInst;
this->Title = "Win32App";
this->ClassName = "Win32";
this->isFullscreen = isFullscreen;
this->PreInitialize();
localWndClass.style = 0;
localWndClass.lpfnWndProc = WindowsProcedure;
localWndClass.cbClsExtra = 0;
localWndClass.cbWndExtra = 0;
localWndClass.hInstance = this->hInst;
localWndClass.hIcon = 0;
localWndClass.hCursor = LoadCursor(0, IDC_ARROW);
localWndClass.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
localWndClass.lpszMenuName = 0;
localWndClass.lpszClassName = ClassName;
RegisterClass(&localWndClass);
if (!isFullscreen)
this->hWnd = CreateWindow(
this->ClassName,
this->Title,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInst,
NULL);
else
this->hWnd = CreateWindow(
this->ClassName,
this->Title,
WS_EX_TOPMOST | WS_POPUP,
0,
0,
SCREEN_WIDTH,
SCREEN_HEIGHT,
NULL,
NULL,
hInst,
NULL);
ShowWindow(this->hWnd, 1);
UpdateWindow(this->hWnd);
this->PostInitialize();
StartMessagePump();
}
LRESULT CALLBACK Win32App::WindowsProcedure(HWND hwnd, unsigned int message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
} break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
void Win32App::StartMessagePump()
{
MSG msg;
DWORD startTime;
while (true)
{
startTime = GetTickCount();
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if(KEY_DOWN(VK_ESCAPE))
PostMessage(hWnd, WM_QUIT, 0, 0);
this->Main();
}
this->CleanUp();
this->~Win32App();
}
DDAPP.H
#pragma once
#pragma comment (lib, "ddraw.lib")
#pragma comment (lib, "dxguid.lib")
#include <ddraw.h>
#include "Win32App.h"
#define INIT_DXSTRUCT(dxs) {ZeroMemory(&dxs, sizeof(dxs)); dxs.dwSize = sizeof(dxs);}
class DDApp : public Win32App
{
public:
DDApp()
{
}
static void LoadBitmap(LPDIRECTDRAWSURFACE7 lpdds, int xDest, int yDest, LPCSTR Filename);
void Restore();
protected:
virtual void DDInitialize() {}
virtual void Update() {}
virtual void RenderFrame() {}
virtual void Release() {}
virtual void PostInitialize();
virtual void Main();
virtual void CleanUp();
LPDIRECTDRAW7 lpDD7;
LPDIRECTDRAWSURFACE7 lpddsPrimary;
LPDIRECTDRAWSURFACE7 lpddsBack;
DDSURFACEDESC2 ddsd;
};
void DDApp::PostInitialize()
{
CoInitialize(NULL);
CoCreateInstance(CLSID_DirectDraw, NULL, CLSCTX_ALL, IID_IDirectDraw7, (void**)&lpDD7);
lpDD7->Initialize(NULL);
if (isFullscreen)
lpDD7->SetCooperativeLevel(hWnd, DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
else
lpDD7->SetCooperativeLevel(hWnd, DDSCL_NORMAL);
lpDD7->SetDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, COLOR_DEPTH, 0, 0);
lpddsPrimary = NULL;
lpddsBack = NULL;
INIT_DXSTRUCT(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.dwBackBufferCount = 1;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
DDSCAPS_COMPLEX |
DDSCAPS_FLIP |
DDSCAPS_VIDEOMEMORY;
lpDD7->CreateSurface(&ddsd, &lpddsPrimary, NULL);
ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
lpddsPrimary->GetAttachedSurface(&ddsd.ddsCaps, &lpddsBack);
DDInitialize();
}
void DDApp::Main()
{
Update();
RenderFrame();
HRESULT r = lpddsPrimary->Flip(NULL, DDFLIP_WAIT);
}
void DDApp::CleanUp()
{
Release();
lpddsBack->Release();
lpddsPrimary->Release();
lpDD7->Release();
}
void DDApp::LoadBitmap(LPDIRECTDRAWSURFACE7 lpdds, int xDest, int yDest, LPCSTR Filename)
{
HDC hSrcDC;
HDC hDestDC;
HBITMAP hbitmap;
BITMAP bmp;
int nHeight, nWidth;
hbitmap = (HBITMAP)LoadImage(hInst, Filename, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE);
hSrcDC = CreateCompatibleDC(NULL);
SelectObject(hSrcDC, hbitmap);
GetObject(hbitmap, sizeof(BITMAP), &bmp);
nWidth = bmp.bmWidth;
nHeight = bmp.bmHeight;
lpdds->GetDC(&hDestDC);
BOOL isSuccess = BitBlt(hDestDC, xDest, yDest, nWidth, nHeight, hSrcDC, 0, 0, SRCCOPY);
lpdds->ReleaseDC(hDestDC);
}
void DDApp::Restore()
{
lpddsPrimary->Restore();
lpddsBack->Restore();
}
FlashViewer::Init() is called from DDInitialize() Function which is called from the PostInitialize() Function which is run after the WIN32 windows creation and before the message pump. I put comments in to try and help out.
if (FV.Init(this->hWnd, SCREEN_WIDTH, SCREEN_HEIGHT))
FV.OpenFlash("C:\\FrontEnd.swf");
|
|
|
|
|
My suspicion would still be threading - and something to do with the message loop. I suspect the Flash control uses one or more threads other than the main UI thread. In that situation, Windows uses window messages to transfer control between threads.
Other than that, I can't really think of any specific advice - sorry
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|