The Wayback Machine - https://web.archive.org/web/20090418080906/http://www.codeproject.com:80/script/Forums/View.aspx?fid=4486
Click here to Skip to main content
6,077,280 members and growing! (15,108 online)
Announcements
* Bold indicates new messages since 23:09 17 Apr '09
BullFrog Power
 

ATL / WTL / STL


Home > Forums > ATL / WTL / STL

 Msgs 1 to 25 of 202 (Total in Forum: 7,480) (Refresh)FirstPrevNext
Questionconvertion vc6 to dotnet2008memberRajeesh MP19hrs 32mins ago 
HI
i need to convert a vc6 project to dotnet2008. i took ATL new project and i added my old vc++ files.

i got some more errors..that everything i fixed...exept one..that is

Error 1 error LNK2001: unresolved external symbol _CLSID_ABC ABC.obj AppFast
Error 2 fatal error LNK1120: 1 unresolved externals .........ABC.dll 1 ABC


the code is like this..in my header file
EXTERN_C const CLSID CLSID_ABC;
#ifdef __cplusplus
class DECLSPEC_UUID("97676011-B0FA-40cf-AECC-7BD3FF54BE4E")
ABC;
#endif


what is wrong...i dont know much about c++
i m working in c# and vb in dotnet2005

Please ,,,i m expecting helps

Regards
Raj


AnswerRe: convertion vc6 to dotnet2008memberStuart Dootson13hrs 1 min ago 
Rajeesh MP wrote:
i need to convert a vc6 project to dotnet2008. i took ATL new project and i added my old vc++ files.


You probably should just have opened the VC6 project in VS2008 - it would have converted it to the right format just fine.


Rajeesh MP wrote:
EXTERN_C const CLSID CLSID_ABC;


I suspect that DECLSPEC_UUID doesn't mean quite the same as it used to or something. You need to add a definition of CLSID_ABC to a .cpp file somewhere.

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: convertion vc6 to dotnet2008memberRajeesh MP3hrs 25mins ago 
Dear Stuart

Uuid is same only..

i have a doubt

#ifndef __AppFastLib_LIBRARY_DEFINED__
#define __AppFastLib_LIBRARY_DEFINED__

/* library AppFastLib */
/* [helpstring][version][uuid] */


EXTERN_C const IID LIBID_AppFastLib;
#endif /* __AppFastLib_LIBRARY_DEFINED__ */

/* Additional Prototypes for ALL interfaces */


this is generating at compiling time in ABC_i.h

if i m manualy trying to add my code. That would be deleted...

EXTERN_C const CLSID CLSID_ABC;
#ifdef __cplusplus
class DECLSPEC_UUID("97676011-B0FA-40cf-AECC-7BD3FF54BE4E")
ABC;
#endif


how do i add this class instant in ABC_i.h

Regards
Rajeesh
GeneralRe: convertion vc6 to dotnet2008memberStuart Dootson3hrs 2mins ago 
I've just had a look at an ATL project I've got. The CLSID for my class is defined in my equivalent of ABC_i.c - is that file (ABC_i.c) being compiled and linked in your project?

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: convertion vc6 to dotnet2008memberRajeesh MP2hrs 25mins ago 
i dont know much more abt this vc++..

how do i link my class to this ABC_i.c

i need to give any reference or any alternate methord..??

After compiling...ABC_i.c is generating...with out my CLSID of my class
GeneralRe: convertion vc6 to dotnet2008memberStuart Dootson47mins ago 
Right-click on ABC_i.c in Solution Explorer and select Properties. Under Configuration Properties->General, the 'Excluded from Build' property should be set to 'No'.

Now rebuild the project. At some point, in the output window, you should see mention of ABC_i.c - that means it is being compiled. Hopefully the project will automatically link with ABC_i.c - if it doesn't, I'm not sure why....

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

QuestionDebuge the COM(ATL) [modified]memberanzhiyue16:00 16 Apr '09  
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

AnswerRe: Debuge the COM(ATL)memberStuart Dootson21:40 16 Apr '09  
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

QuestionActiveX [modified]memberpradeep4550:16 16 Apr '09  
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

QuestionSTL vector, search for a sequencememberkaminem23:16 13 Apr '09  
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
AnswerRe: STL vector, search for a sequencememberStuart Dootson23:46 14 Apr '09  
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

AnswerRe: STL vector, search for a sequencemvpStephen Hewitt1:58 15 Apr '09  
Why not use std::search[^]?

Steve

GeneralRe: STL vector, search for a sequencememberStuart Dootson21:34 16 Apr '09  
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

QuestionAtlAxAttachControl - An outgoing call cannot be made since the application is dispatching an input-synchronous call.memberbfoo7514:19 9 Apr '09  
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.
AnswerRe: AtlAxAttachControl - An outgoing call cannot be made since the application is dispatching an input-synchronous call.memberStuart Dootson23:14 14 Apr '09  
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

QuestionCan CAxWindow's subclass implement in a dll, and create in exe program?memberSearchDream0:39 31 Mar '09  
Hi everyone:
Just like the subject, thanks.
AnswerRe: Can CAxWindow's subclass implement in a dll, and create in exe program?memberStuart Dootson7:56 31 Mar '09  
If it's a non-template class and you export it from the DLL[^], sure, why not?

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Can CAxWindow's subclass implement in a dll, and create in exe program?memberSearchDream19:25 31 Mar '09  
OK, thanks for your reply, I have fixed the problem, the exe need to choose link to ATL.
QuestionIs there anyway to authenticate the COM client?memberlucyh3h7:05 30 Mar '09  
Hi,

I have a COM server (not DCOM) and would like to only accept calls from one known client. Is there anyway that the COM server can find out the caller's information and determine if the client is trusted?
I've seen the documents about the security features, mostly for DCOM, that usually involve user authentication. But in my case, both client and server runs on the local machine.

Thanks,
AnswerRe: Is there anyway to authenticate the COM client?memberStuart Dootson7:57 30 Mar '09  
IServerSecurity[^]?

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Is there anyway to authenticate the COM client?memberlucyh3h11:37 30 Mar '09  
hmm, that is not exactly what I need. I looks like I can find out the user information, who runs the client. But not the client process itself.
Is there anyway I can find out more client information, for example, the client process id.
GeneralRe: Is there anyway to authenticate the COM client?memberStuart Dootson12:28 30 Mar '09  
lucyh3h wrote:
Is there anyway I can find out more client information, for example, the client process id.


You could get the client to tell you its process id?

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Is there anyway to authenticate the COM client?memberlucyh3h5:19 31 Mar '09  
No, I am trying to authenticate the client, so I don't trust whatever it tells me.
I guess this is an issue common to all Local RPC. Does the server always trust the client running on the same machine?
GeneralRe: Is there anyway to authenticate the COM client?memberStuart Dootson7:43 31 Mar '09  
I suspect the standard COM security API[^]s are the only real way to authenticate the client.

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

QuestionIs forward declaration of ATL autogenerated _com_ptr_t possible?memberStone Free5:17 26 Mar '09  
In normal C++ when a class header only contains a reference or a pointer to a class it is better to not #include the definition but wait until the .cpp file to avoid coupling/avoid recompilation.

In our of our class headers the reference concerned is to a smart pointer generated from a #import, in other words a smart pointer of the form _COM_SMARTPTR_TYPEDEF(IComInterface, &__uuidof(IComInterface))

Which expands to typedef _com_ptr_t<_com_IIID<icominterface,> > IComInterface;

I think the problem is that the __declspec(uuid("GUID VALUE")) which is attached to the forward declaration of the IComInterface struct like __stdcall and __fastcall is part of the declaration and so will produce different types depending on the contents of uuid. The problem however is that the uuid contents will be autogenerated by the #import line, and so it won't be possible know ahead of time to know what to put in the typedef.

I also think that the $(InputName)_i.c file generated when building the COM component won't help because although it contains the correct GUID it won't be in the correct form for __uuidof

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Last Updated 9 Aug 2007
Web11 | 2.2.1067 | Advertise | Privacy
Copyright © CodeProject, 1999-2009
All Rights Reserved. Terms of Use