|
Have you tried installing them both and...well, just using them?
It should just be a case of setting suitable include and library paths for the compiler toolchain, I would have thought?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
|
|
Well, the example you point at is for VC6, not VS2008 (which I guess is what you mean - there's no VC++2009) - and ATL has changed quite a lot since VC6.
You might try this more up to date example[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
You must be a mind reader!!
Yes, it's 2008 (I was in a hurry and saw v 9 in Help->About)
Thanks a lot!!
I will give that example a try!
|
|
|
|
|
Dang it!
I opened the *.sln, Visual Studio did the conversion.
When I click build it does so in <1 second and says:
1>------ Skipped Rebuild All: Project: ATLCon ------
1>
========== Rebuild All: 0 succeeded, 0 failed, 1 skipped ==========
No output files are created.
If I open any of the *.cpp files and attempt to compile them individually I get a popup message saying The operation could not be completed. Unspecified Error. ...
I tried the attribute and non-attribute versions.
One of the comments in the conversion log of the non-attributes version says "ATL Server support has been removed from this version of Visual Studio. In case your ATL Project uses any ATL Server functionality, your project may not build. Please consult the MSDN documentation for a list of alternatives." so... Is ATL going away or somthing...?
|
|
|
|
|
|
Bummer... the atlcon samples that come with vs 2008 msdn install don't work either
C:\Program Files\Microsoft Visual Studio 9.0\Samples\1033\AllVCLanguageSamples\C++\ATL\General\AtlCon
|
|
|
|
|
I'll see if I can create a new project with the ATL & MFC support options selected and add the source files to it.
Perhaps that will work...
|
|
|
|
|
Worked for me - but I did notice that the default configuration was "Debug Itanium" - I suspect that a) you don't have an Itanium chip in your PC, and b) you don't have the Itanium cross-compilers installed, so if that's the configuration you've got, try the Win32 configuration
I couldn't try it with an Adobe Reader control - I don't have Adobe Reader installed on my Windows VM on my Mac - OS X's Preview app does the job of reading PDFs better and more quickly
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
DOH!
I didn't see the "Itanium" setting.
I switched it to "win32" and it compiles and runs!
Thanks for your help!
I'm going to take a closer look at this to see if I can figure out how to get this to work in a win32 HWND now.
Again, thanks for your help!
|
|
|
|
|
Sorry - thought I'd pointed you at a VS2008 sample
Not sure why the sample requires ATL Server - but it was open-sourced and can be downloaded on CodePlex[^]. It was probably for some utility class that did actually get moved to ATL.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I am able to get the ActiveX control to load now.
The thing that made this work was using
hr = AtlAxCreateControl( OLESTR( "c:\\test.pdf" ), pThreadParam->hwnd, NULL, &pUnk ); instead of using ::CreateWindow(...) or trying to use AtlAxWindow().
HOWEVER (darn it!) when I close the application window I get an access violation in the message loop:
while( 1 )
{
rv = GetMessage(&msg, NULL, NULL, NULL) ;
rv = TranslateMessage(&msg);
rv = DispatchMessage(&msg);
}
It is erroring in the call to "GetMessage(...)".
I thought it might be that I need to send a WM_CLOSE message before the main window closes, but that doesn't help.
If I send WM_CLOSE it seems to cause an access violation in a different thread of the main application.
I tried breaking out of the message loop if WM_CLOSE (or some other event) is detected, but that just caused the app to hang (as I would expect).
Is there any way to unload the ActiveX control from the win32 cleanly?
I'm sure there is a way, I'm just not seeing it.
I can send source code if that would be useful.
I which I could attach it instead of inlining it though.
|
|
|
|
|
Did you ever Release that IUnknown pointer you got back in pUnk? If not, the control will likely think it's meant to stick around, as its reference count never gets to zero. That could cause issues.
snacker2 wrote: I get an access violation in the message loop
Where exactly (look at the call-stack)
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I was saving the reference in memory and calling release just before the window is closed.
But now...
I changed it to call Release().
Here is how I am creating the control (changed to use a url):
VOID CreateControl( HWND hwnd )
{
HRESULT hr = CoInitialize( NULL );
printf( "CoInitialize(NULL) -> hr=[0x%x]\n", hr );
printf( "Create AtlAxWin Begin...[0x%x]\n", hwnd );
BOOL rslt = AtlAxWinInit();
printf( " AtlAxWinInit() --> %d\n", rslt );
IUnknown *pUnk = NULL;
hr = AtlAxCreateControl( OLESTR( "http://www.microsoft.com" ), hwnd, NULL, &pUnk );
printf( "AtlAxCreateControl(...) -> hr=[0x%x] : pUnk=[0x%x]\n", hr, pUnk );
ULONG relRslt = pUnk->Release();
printf( "Release() -> %d\n", relRslt );
}
Here is the output:
CoInitialize(NULL) -> hr=[0x0]
Create AtlAxWin Begin...[0x150dac]
AtlAxWinInit() --> 1
AtlAxCreateControl(...) -> hr=[0x0] : pUnk=[0x3233e30]
Release() -> 7
Although the "Release() " is returning 7, it appears to be working... ONLY if I send WM_CLOSE to the HWND prior to closing the window.
However, I don't think I want to close the HWND in all cases.
Is there a way to just remove or unload the control, so the HWND can be reused?
In fact if I use Adobe Reader via specifying c:\test.pdf it works until I shutdown the application.
At the end of the app I get an access violation:
> Multimedia.api!2d80acf5()
[Frames below may be incorrect and/or missing, no symbols loaded for Multimedia.api]
msvcr80.dll!04932bd9()
Multimedia.api!2d83e2a5()
Multimedia.api!2d802cc0()
Multimedia.api!2d80c885()
Multimedia.api!2d80123c()
Multimedia.api!2d8b3698()
Multimedia.api!2d80101d()
ntdll.dll!7c90118a()
ntdll.dll!7c923ada()
ntdll.dll!7c910435()
ntdll.dll!7c90eb99()
kernel32.dll!7c81cb26()
java.exe!004071b4()
java.exe!004072f3()
java.exe!00407319()
java.exe!004087cb()
kernel32.dll!7c817077()
java.exe!00410072()
java.exe!00410072()
java.exe!00410072()
java.exe!00410072()
I'm guessing the java vm doesn't know about the win32 HWND being "closed"... but that's just a guess?
|
|
|
|
|
However... perhaps I could create a child window which is just a child to the HWND passed in?
Perhaps that would prevent the jvm crashing at the end?
|
|
|
|
|
snacker2 wrote: HWND passed in
What is that HWND? Is it the dialog HWND? Because really, it needs to be the HWND of a window whose ONLY responsibility is containing the ActiveX control. As I said, what I did was to create a STATIC control with no text, then pass its HWND to the ActiveX creation function. Then, when the dialog closes, it closes the STATIC's window for me, I don't need to do anything.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
The HWND is the handle for a java.awt.Canvas.
I'm getting the HWND as is documented in the jni docs which is shown here:
Implement the C++ native code[^]
The create function you're referring to is AtlAxCreateControl( OLESTR( "http://www.microsoft.com" ), hwnd, NULL, &pUnk ) , correct?
What do you mean "with no text"?
So it looks like I need to create a new window as a child of the HWND I'm getting from the java.awt.Canvas and create the control on that window instead of the one from java...?
(thanks again for your help with this)
|
|
|
|
|
snacker2 wrote: What do you mean "with no text"?
I mean I didn't add any text to the static text control - probably of little relevance.
snacker2 wrote: The create function you're referring to is AtlAxCreateControl( OLESTR( "http://www.microsoft.com" ), hwnd, NULL, &pUnk ), correct?
Yep - I used a different first parameter (I passed the progid of the calendar ActiveX control - but that (again) is of little relevance.
snacker2 wrote: So it looks like I need to create a new window as a child of the HWND I'm getting from the java.awt.Canvas and create the control on that window instead of the one from java...?
That's what I'm suggesting.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
I will try passing NULL.
I am confused as to why it was returning 7 instead of zero, but I assumed it was because at least the control container and control itself had references to it.
I will take a look at the link you sent.
|
|
|
|
|
What I am trying to do is when I click a button it draws a cube or whatever and displays the name of the object in a
GLUI_EDITTEXT_TEXT box.I also want to append a number to the end of the object name and increment the number each time a new object is drawn. I have everything working ok except the name and number will only display one character at a time in the textbox and increments the position each time the draw button is pushed. Much Thanks to anyone who will/can help with this. Jody Bush
Below is part of the code I have for this thing.
int Cnum = 1;
int Pnum = 1;
char Cube[sizeof(GLUI_String)] ={" "};
char Plane[sizeof(GLUI_String)] ={" "};
char Name;
Name1 = subwin->add_edittext( "Name", GLUI_EDITTEXT_TEXT,&Name);
if(control == DRAWPLANE_ID){
drawplane = true;
sizex = 1.0;
sizey = 1.0;
sizez = 0.0;
itoa(Pnum, Plane, 10);
sprintf(Plane,"Plane %d",Cnum);
Name = Plane[Pnum];
Name1->get_text();
Pnum++;
}
if(control == DRAWCUBE_ID){
drawcube = true;
sizex = 1.0;
sizey = 1.0;
sizez = 1.0;
itoa(Cnum, Cube, 10);
sprintf(Cube,"Cube %d",Cnum);
Name = Cube[Cnum];
Name1->get_text();
Cnum++;
}
|
|
|
|
|
bushimports wrote: I have everything working ok except the name and number will only display one character at a time in the textbox and increments the position each time the draw button is pushed
I think your problem is that you're only passing in one character to the add_edittext call. I don't know what the signature of the method is, but &Name can only refer to a single character (and then, so long as a coincidence of code generation puts zero bytes on the stack.
Anyway I think the problem would probably be solved by
- Declaring Name as
char* Name; - Changing how you assign Name, from
Name = Plane[Pnum];
and
Name = Cube[Cnum];
to
Name = Plane;
and
Name = Cube;
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
How to save on javascript Type the 'IDC_LAT'values in NMEAParserDemo Dialogbase
source
|
|
|
|