|
I am trying to implement tree control context menus and their not working very well. When right-clicking on an item, the item is not selected, making the context menu very useless. The tree control is in a dialog bar. What could be the problem?
-- Steve
|
|
|
|
|
You're getting either NM_RCLICK or WM_CONTEXTMENU too soon, not that you can do anything about that. What I've done in similar situations is to use PostMessage to send a private message that tells me to pop up a context menu. By the time I receive this, the select operation has completed. Alternatively, you have to get the coords of the mouse at the time of the original message and hit test the items yourself, then update the selection state.
Sounds trickier than it is, really...
Steve S
[This signature space available for rent]
|
|
|
|
|
My application needs to run 2 powerpoint presentations in a "kiosk" manner. One is a screensaver, that is shown until the user moves the mouse, when the application should automatically display the interactive application.
The app is able to show the presentations, but how can I get some kind of mousemove event from Powerpoint so that I can change the presentation being shown?
Thanks in advance.
G. Raven
|
|
|
|
|
I'm actually trying to solve a similar problem myself. In my case, what I'd like to do is to be able to detect mouse clicks on elements in a running PowerPoint presentation, or at least clicks in the PowerPoint window. Can anyone give me some suggestions on how to do this, or let me know if it's even possible?
|
|
|
|
|
Hello all,
I am currently writing a COM plug-in for Outlook that gets all AppointmentItem data utilizing Invoke and calling methods such as GetSubject and GetAddress. However, I need to get the recurrence pattern of the AppointmentItem and I am unsure how to setup the Invoke call to get this to work. Also, I don't know the return value. Unfortunately, MSDN only shows how to do this using a typelib, and I have been unable to find anything on the web on how to do a straight COM call. Does anyone have any idea on how to get the recurrence for a particular AppointmentItem?
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
I implemented the following code using ATL COM and implemented the method MachineID.
I have declared MAX_OF_HARD_DISKS and HardDiskLetters[] as follows
#define MAX_OF_HARD_DISKS 24
static char HardDiskLetters[MAX_OF_HARD_DISKS][4]={
"c:\\", "d:\\", "e:\\", "f:\\", "g:\\", "h:\\",
"i:\\", "j:\\", "k:\\", "l:\\", "m:\\", "n:\\",
"o:\\", "p:\\", "q:\\", "r:\\", "s:\\", "t:\\",
"u:\\", "v:\\", "w:\\", "x:\\", "y:\\", "z:\\"
};
STDMETHODIMP CSerialno::MachineID()
{
// TODO: Add your implementation code here
ULARGE_INTEGER AvailableToCaller, Disk, Free;
for (int iCounter=0;iCounter
|
|
|
|
|
adsilva wrote:
I get error at code GetDiskFreeSpaceEx as "cannot convert parameter 1 from char[4] to const unsigned short* "
static TCHAR HardDiskLetters[][MAX_OF_HARD_DISKS]={
"c:\\", "d:\\", "e:\\", "f:\\", "g:\\", "h:\\",
"i:\\", "j:\\", "k:\\", "l:\\", "m:\\", "n:\\",
"o:\\", "p:\\", "q:\\", "r:\\", "s:\\", "t:\\",
"u:\\", "v:\\", "w:\\", "x:\\", "y:\\", "z:\\"
};
RSS feed
|
|
|
|
|
Thanks a lot!!
But now I am getting 25 errors after changing char to TCHAR. Do I need to add any header file to get rid of the errors.
The error is as follows
error C2440: 'initializing' : cannot convert from 'char [4]' to 'unsigned short'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Thanks
Anna
|
|
|
|
|
I didn't only change char to TCHAR. I have also changed the order in [][] dimensions.
The overall code compiles and runs fine on my machine (vc++6.0).
RSS feed
|
|
|
|
|
Sorry!! Still I just can't get rid of the errors!!
D:\Backup Codes\Crypts\Serialno.cpp(18) : error C2440: 'initializing' : cannot convert from 'char [4]' to 'unsigned short'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Note: I have used this code in ATL COM .
Thanks ,
Anna.
|
|
|
|
|
adsilva wrote:
D:\Backup Codes\Crypts\Serialno.cpp(18) : error C2440: 'initializing' : cannot convert from 'char [4]' to 'unsigned short'
There's something odd anyway. The error should be "cannot convert from 'char [4]' to 'unsigned short*" (note the *) since GetDiskDriveSpaceEx takes a LPCTSTR as first parameter. LPCTSTR is unsigned short* if you compile with UNICODE, and is unsigned char* if not.
RSS feed
|
|
|
|
|
Earlier I was getting the following error when I was declaring harddiskletters as
static char HardDiskLetters[MAX_OF_HARD_DISKS][4]={
"c:\\", "d:\\", "e:\\", "f:\\", "g:\\", "h:\\",
"i:\\", "j:\\", "k:\\", "l:\\", "m:\\", "n:\\",
"o:\\", "p:\\", "q:\\", "r:\\", "s:\\", "t:\\",
"u:\\", "v:\\", "w:\\", "x:\\", "y:\\", "z:\\"
};
D:\Backup Codes\Crypts\Serialno.cpp(52) : error C2664: 'GetVolumeInformationW' : cannot convert parameter 1 from 'char [4]' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
After changing to
static TCHAR HardDiskLetters[][MAX_OF_HARD_DISKS]={
"c:\\", "d:\\", "e:\\", "f:\\", "g:\\", "h:\\",
"i:\\", "j:\\", "k:\\", "l:\\", "m:\\", "n:\\",
"o:\\", "p:\\", "q:\\", "r:\\", "s:\\", "t:\\",
"u:\\", "v:\\", "w:\\", "x:\\", "y:\\", "z:\\"
};
I am getting 25 errors which points to the line where the above declaration is made.
the error reads as follows
D:\Backup Codes\Crypts\Serialno.cpp(18) : error C2440: 'initializing' : cannot convert from 'char [4]' to 'unsigned short'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Thanks,
Anna.
|
|
|
|
|
If you rollback to what you had before you could explicitely cast
HardDiskLetters[i]
to :
(LPCTSTR)(HardDiskLetters[i])
I believe the compiler would be ok then. Quite honestly, I didn't suggest this solution first because explicit cast at this point is bad code.
If you are willing to keep the code I suggest, just send it to me so I can test it (make a zip, and forward it by clicking on the [Email] link below).
RSS feed
|
|
|
|
|
Thanks a lot!!
Its working now . I explicitly type casted HARDDISKLETTERS as you mentioned.
I have a query. I want to assign a varaible declared as DWORD to a string .
For eg;
DWORD harddiskspace ;
I get some value in harddiskspace . I want to retrieve as a string .
Thanks ,
Anna.
|
|
|
|
|
#include <stdio.h>
char szTmp[32];
DWORD harddiskspace = ...;
sprintf(szTmp,"%ld",harddiskspace);
RSS feed
|
|
|
|
|
Don't do it that way! What you need to do is:
<br />
#define MAX_OF_HARD_DISKS 24<br />
static TCHAR HardDiskLetters[MAX_OF_HARD_DISKS][4]={<br />
_T("c:\\"), _T("d:\\"), _T("e:\\"), _T("f:\\"), _T("g:\\"), _T("h:\\"),<br />
_T("i:\\"), _T("j:\\"), _T("k:\\"), _T("l:\\"), _T("m:\\"), _T("n:\\"),<br />
_T("o:\\"), _T("p:\\"), _T("q:\\"), _T("r:\\"), _T("s:\\"), _T("t:\\"),<br />
_T("u:\\"), _T("v:\\"), _T("w:\\"), _T("x:\\"), _T("y:\\"), _T("z:\\")<br />
};<br />
This will compile as either an ANSI array of strings or a UNICODE array of strings. By casting, you would be passing an 8-bit string to a function that expects a 16-bit string. The function could not work with that. Also, note the order of the array subscripts. This should work - but I did not test it.
Good Luck,
Mike_V
|
|
|
|
|
How can I add a custom menu to Internet Explorer(i.e an extra menu to Internet Explorer like utilities to do certain task)
|
|
|
|
|
hi there..
firstly thanks for your time..
secondly i wanted to know 3 things:
1. my container also crashes when i remove my control from the test container...cant figure out the reason...possibly something to do with the releasing of this pointer..
2. what is the normal procedure in which u can exit a control, i mean all the releases and exitinstances and destructors?
3. from where can i get a sample OLE control so that i can use it for studying purposes..
thanks and kindest regards
safee
|
|
|
|
|
The simplest way to solve the issue is to start a debug session for your ActiveX component by first of all pointing the executable to "ActiveX test container" in your Project settings \ Debug Tab.
If you put a breakpoint in a destructor somehow, the session will halt there and hopefully it will be possible to isolate the issue.
RSS feed
|
|
|
|
|
yup got it..
thanks a lot
One more thing if u may have time..how can i check for memory leaks in my application??
ne ideaz!
thanks
kindest regards
safee
|
|
|
|
|
safeeullah wrote:
One more thing if u may have time..how can i check for memory leaks in my application??
When the debug session ends, it shows all leaks in the console window. If you are using MFC, you'll have plenty of details and will be able to double-click on the messages to reach the actual code being guilty. If you are not using MFC, you can instrumentalize your code by either of those :
- lookup this article[^] on CodeProject
- buy a commercial product like BoundsChecker (from Numega).
RSS feed
|
|
|
|
|
thanks stephane..
one last thing
i solved the crashing issue as well as the leak checking..
then i build my control in release mode..
when i built it in release mode, my spreadsheet stopped taking in data entries to cells..
ne information on this?
thanks again
|
|
|
|
|
safeeullah wrote:
when i built it in release mode, my spreadsheet stopped taking in data entries to cells..
1) Check out you don't have significant code in a
#ifdef _DEBUG
...
#endif
section. Because in release mode, no code would be generated.
2) If the debug mode works fine, and the release mode doesn't, it's usually because the code is weak. There is a probably a bad use of pointers somewhere.
- check out the console window for all "exception errors" that might be produced by Excel (or any other ActiveX host).
- build the release mode with "Debug Info". And check the ".pdb" box. Doing so, you can put a breakpoint even in release mode.
- Add a DebugBreak() statement in your code. This allows to halt the code, start a session, and watch variables, etc. To have this to work properly, it's best to generate a release version with all the debug info (see above).
- add a few message boxes in your code, and watch them. That's the most primitive way of solving issues, but sometimes it's enough!
Good luck!
And if you are to go on with debugging, crash handlers, etc. don't hesitate to buy this book[^].
RSS feed
|
|
|
|
|
After reading several boards, I'm close but no cigar. I have an existing C++ app that calls my vc6 dll which calls a vb6 dll. That seems to work fine except when I try to call a function in the vc dll from the vb dll. It works fine if I call the c++ dll from a vb exe. For this test, the calling vc app does a simple call to fakePlugIn().
The vc dll:
#include "stdafx.h"
#import "testvb.dll"
using namespace testvb;
extern "C" __declspec(dllexport) fakePlugIn()
{
HRESULT hresult;
CLSID clsid;
_vbdllcls *t;
CoInitialize(NULL); //initialize COM library
hresult=CLSIDFromProgID(OLESTR("testvb.vbdllcls"), &clsid);
hresult=CoCreateInstance(clsid,NULL,CLSCTX_INPROC_SERVER,__uuidof(_vbdllcls),(LPVOID *) &t);
if(FAILED(hresult))
{
AfxMessageBox("Creation Failed");
return false;
}
t->InVbDll("string to vb dll"); //call the vb dll
t->Release();
CoUninitialize();
return true;
}
extern "C" void __declspec(dllexport) Callback(void)
{
AfxMessageBox("in callback");
}
The vb code:
Public Declare Function Callback Lib "testcpp.dll" () 'this is in a module
Public Function InVbDll(ByVal s As String) As Long 'this is in class vbdllcls
MsgBox s
Callback
End Function
With Callback defined as __declspec(dllexport), the message box in Callback gets executed but then I get a runtime error: Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.
OK so I tried __stdcall instead. Then I don't make it to the Callback and get a runtime error:
First-chance exception at 0x77e73887 in cppshell.exe: 0xC000008F: Floating-point inexact result.
First-chance exception at 0x77e73887 in cppshell.exe: Microsoft C++ exception: _com_error @ 0x0012fbac.
I've tried various combinations as well with the same result. Ultimately, I'd like to pass strings into and possibly out of Callback, but one step at a time.
Any light you could shed on this would be appreciated!
|
|
|
|
|
I am hosting the Web Browser control in an application, and am setting the initial nav URL to a local directory. I would like to default the "View" to Thumbnails, but I cannot find where the View Type property is exposed.
Does anyone know how I can get access to this property and set it?
I have checked all the exposed interfaces for this control and did not see where this might be exposed as a method. The IWebBrowser2 interface exposes two Methods "GetProperty and PutProperty", not sure I could use these, mainly because I would have to know the property to get/put.
Any help would be great!
Thanx,
D.
|
|
|
|
|