|
hINTModuleState wrote: HANDLE is a void*, so it is an address.
It is not a valid address in the application address space.
hINTModuleState wrote: How can I display the content of a HANDLE
You can just display its (numerical) value.
hINTModuleState wrote: how can I construct it from a displayable text value ??
??? ???
BTW if you want to play with the handles, then you must follow the rules of the game
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
it turned out to be not even a valid address anywhere, rather an access number behind which resides a pointer which holds the actual address to the actual internal structure (whether a window, or whatsoever...)
OK I 'llwith it just like an INT....
"The Awaited Saviour", Mohammed Baqir Al Sadr
|
|
|
|
|
Hi,
I am trying to load a bitmap image in a CRichEditCtrl using InsertBitmap function as:
bool CChatDlg::InsertBitmap(HWND RichEdithWnd, HBITMAP hBitmap)
{
IDataObject * pDataObject;
IOleObject * pOleObject;
IStorage * pStorage;
IOleClientSite * pOleClientSite;
LPLOCKBYTES LPLockBytes = NULL;
FORMATETC FormatEtc;
IRichEditOle * pRichEditOle;
SCODE SCode;
REOBJECT ReObject;
CLSID ClSid;
char * Texte = "";
static char Texte2[] = "";
HGLOBAL hGlobal;
CWnd pWnd;
CoInitialize(NULL);
if(OpenClipboard())
{
Texte = new char[256 + ZERO_FIN];
Texte = (CHAR *)GetClipboardData(CF_TEXT);
sprintf(Texte2, "%s", Texte);
EmptyClipboard();
SetClipboardData(CF_BITMAP, hBitmap);
CloseClipboard();
}
else return 0;
hGlobal = GlobalAlloc(GMEM_DDESHARE, strlen(Texte2) + 1);
Texte = (CHAR *)GlobalLock(hGlobal);
sprintf(Texte, "%s", Texte2);
GlobalUnlock(hGlobal);
m_richEdit.SendMessage(EM_GETOLEINTERFACE, 0, (LPARAM)&pRichEditOle);
if (pRichEditOle == NULL) return 0;
OleGetClipboard(&pDataObject);
if (pDataObject == NULL) return 0;
FormatEtc.cfFormat = CF_BITMAP;
FormatEtc.ptd = NULL;
FormatEtc.dwAspect = DVASPECT_CONTENT;
FormatEtc.lindex = -1;
FormatEtc.tymed = TYMED_GDI;
pRichEditOle->GetClientSite(&pOleClientSite);
if (pOleClientSite == NULL) return 0;
SCode = CreateILockBytesOnHGlobal(NULL, true, &LPLockBytes);
if (LPLockBytes == NULL) return 0;
SCode = StgCreateDocfileOnILockBytes(LPLockBytes, STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE, 0, &pStorage);
if (pStorage == NULL) return 0;
OleCreateStaticFromData(pDataObject, IID_IOleObject, 2, &FormatEtc, pOleClientSite, pStorage, (void**)&pOleObject);
if (pOleObject == NULL) return 0;
OleSetContainedObject(pOleObject, true);
ZeroMemory(&ReObject, sizeof(REOBJECT));
ReObject.cbStruct = sizeof(REOBJECT);
SCode = pOleObject -> GetUserClassID(&ClSid);
ReObject.clsid = ClSid;
ReObject.cp = REO_CP_SELECTION;
ReObject.dvaspect = DVASPECT_CONTENT;
ReObject.poleobj = pOleObject;
ReObject.polesite = pOleClientSite;
ReObject.pstg = pStorage;
pRichEditOle -> InsertObject(&ReObject);
if(OpenClipboard())
{
EmptyClipboard();
SetClipboardData(CF_TEXT, hGlobal);
CloseClipboard();
}
else return 0;
LPLockBytes -> Release();
pRichEditOle -> Release();
pOleObject -> Release();
pOleClientSite -> Release();
pStorage -> Release();
pDataObject -> Release();
CoUninitialize();
return 1;
}
but the function call
OleCreateStaticFromData(pDataObject, IID_IOleObject, 2, &FormatEtc, pOleClientSite, pStorage, (void**)&pOleObject);
fails and return 0.
Please help me whats the problem.
Thanks In Advance.
Dhiraj Kumar Saini
|
|
|
|
|
Hi friends..
I need to show date and time both at a time in the DateTimePicker
right now i have seen all examples of DateTimePicker show to disply only date r only time at a time.
can some one help me how to show date and time both at a time in DateTimePicker. please let me know if it can be done?
thank u in advance
|
|
|
|
|
You can set custom format using SetFormat()
e.g. from msdn
CString formatStr= _T("'Today is: 'yy'/'MM'/'dd");
m_dtPicker.SetFormat(formatStr);
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
thats really nice idea.
and also is there any way that i can show date calender for date and spin control for for time at a time in the UI?
i need to show calender for date and spin control for time at a time
will that be possible?
please let me know
|
|
|
|
|
sarat12in wrote: will that be possible?
Yes, if you use the DTS_TIMEFORMAT style.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
DTS_TIMEFORMAT will only shows the time but not date calender
i need to show date calender and time spin control
any suggestion please
thank you
|
|
|
|
|
i will go with the first suggestion.
but the problem in here is.. if i mention date time format programatically with setFormat , then the display format wont get changed depends on locale
its a big problem for me.
is there any way that i can get the system format fist and pass it as a string to SetFormat? r is there any other way to handle this scenario?
Thanx in advance
|
|
|
|
|
sarat12in wrote: is there any way that i can get the system format fist and pass it as a string to SetFormat?
Yes. Use GetDateFormat() and GetTimeFormat() .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
If you want both the date and time in the same control, you'll need to use a format string rather than one of the preset formats. See here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi All,
I have designed (through project resources) and displayed a dialog box in c++ by inheriting my own class from CAxDialogImpl class and using mydlgobj.DoModal() method.
I have used this in my own created plugin for windows mail/outlook express. (dialog pops up, when menu item is clicked).
BUT problem is that DoModal is displaying a modeless dialog box not the modal one...
If I use the same procedure in my plugin for outlook, then the dialog box is modal, (as it should be).
Kindly tell me what should I do to show it as a modal dialog box in my windows mail/outlook express plugin?
Thanks!
Dolly,
N,IN
|
|
|
|
|
Hello All,
I’m having problem with intercepting all calls to restart Microsoft Internet Information Services(IIS) 6.0.
I’m trying to write a Hook that will intercept all request to iisreset – i.e. if you execute iisreset.exe, I want my code in(C/C++) to suppress the restarting/stopping of IIS, do some processing work for me first and then allow iis to be restarted/stopped.
So, far my approach has been to write a system wide global HOOK dll and attached it to the inetinfo.exe process. On testing of the hook, it works for notepad.exe but does not work for inetinfo.exe. I’m using the SetWindowsHookEx function with the WH_GETMESSAGE parameter – as my understanding is that WH_GETMESSAGE should work for non-gui process as well.
My questions to you all are:
1. Is it even feasible to do what I want to do – that is to intercept all calls to iisreset?
2. If yes to the first question, then is hooking the right choice?
3. Does hooking work for Non-GUI process – as inetinfo.exe and iisreset.exe are non-gui and may not have a window procedure?
Thanks for all the help,
Jr.
|
|
|
|
|
Hello all,
How can i change text of the particular menu item in MFC? I have id of that menu item.
Please let me know if you have any idea.
Regards,
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Have a look at CMenu::ModifyMenu
|
|
|
|
|
Thanks for quick reply,
I have seen that function. It runs fine but i am not able to see any change to the text of the menu item.
Is there any rule to use this function, If so then please let me know.
Let me know if you have any other solution.
Thanks and Regards,
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Sample:
CMenu* pMenu = GetMenu();
pMenu->ModifyMenu( ID_FILE_SAVE, 0, ID_FILE_SAVE, "New Save" );
|
|
|
|
|
Sorry but i am not able to use it with System Tray popup menu.
Actually i have used this library to create a System Tray pop up menu.
http://www.codeproject.com/KB/shell/systemtray.aspx[^]
So, Do you have any idea on this?
Regards,
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
I am not familiar with that library. Anyway if you have the menu handle, then you can surely update it.
But I could find a BOOL SetMenuText(UINT uiCmd, LPCTSTR szText); in the documentation... Did you try that?
|
|
|
|
|
You can add a UI handler for the menu item
ON_UPDATE_COMMAND_UI
and do something like
void CYourClass::OnUpdateYourMenuItem(CCmdUI* pCmdUI)
{
pCmdUI->SetText("New Menu Text");
}
|
|
|
|
|
Wanted to say, thanks for posting this. I had been scratching my head trying to figure out how to do this and was making it a far more difficult chore than it needed to be. This was the answer, so simple that I hadn't even considered it. worked perfectly by the way.
Mike - typical white guy.
"Political correctness is a doctrine, fostered by a delusional, illogical minority, and rabidly promoted by an unscrupulous mainstream media, which holds forth the proposition that it is entirely possible to pick up a piece of sh*t by the clean end."
Thomas Mann - "Tolerance becomes a crime when applied to evil."
As American as: hot dogs, apple and Sarah Palin.
|
|
|
|
|
hi to all,
need to pass a string to a void function that does not have a parameter, looks like that:
int CMyString::GetLength (void)const
{
}
in the main function, the code is follow
CMyString string1;
string1 = "Hello world!";
int nLen = string1.GetLength();// should give nLen = 11.
The class CMyString should work like the class String in this case.
Do not k now how to implement the function GetLength().
Any help will be appriciated. Thanks.
|
|
|
|
|
you don't know how to create a method in your own class ?
the class CMyString should hold a member variable that holds the buffer of some sort of the string.
just create a method that just do a strlen (if the buffer is a char* ) on the member variable.
something like :
class CMyString
{
//... some other stuff
char* m_internalBuffer;
int GetLength(){ return strlen(m_internalBuffer);};
}
|
|
|
|
|
You should (like CString , for instance does):
- define a
CMyString constructor accepting a const char * as argument. - overload the
CMyString assignment operator (= ) to accept a const char * as argument. - both of the above methods should initialize
CMyString internal data member (a character buffer, for instance). - define a
GetLenght method returning the strlen of the internal character buffer.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
susanne1 wrote: string1 = "Hello world!";
int nLen = string1.GetLength();// should give nLen = 11.
Why would you want to use a function that returned an incorrect value?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|