|
Hey
I have an icon. I would like to insert the icon into a toolbar.How to do?
Thanks
JP
|
|
|
|
|
Insert an icon means to insert a new toolbar button if so use TB_INSERTBUTTON message to do it.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Use...
TB_INSERTBUTTON
AddButton(...);
which has following paramater
HRESULT AddButtons(
int nButtons, // number of buttons
LPMMCBUTTON lpButtons // pointer to an MMCBUTTON structure
);
LPMMCBUTTON .....
typedef struct _MMCBUTTON
{
int nBitmap ;
int idCommand;
BYTE fsState;
BYTE fsType;
LPOLESTR lpButtonText;
LPOLESTR lpTooltipText;
} MMCBUTTON;
typedef MMCBUTTON* LPMMCBUTTON;
regards
Balkrishna Talele
|
|
|
|
|
access violation 0xC0000005 when calling func in dll
hi,guys:
ask for your kind help. thanks in advance.
typedef int (WINAPI * _DLL_FOO)(int, char **, int, char **, LPDCL, LPUSERFUNCTIONS);
......
_DLL_FOO m_PFoo;
......
LoadLibrary successfully。
m_PFoo = (_DLL_FOO)GetProcAddress(m_hDll, "Foo"); //successfully
326: retval = (*m_PFoo)(infc, infv, exfc, exfv, m_lpDCL, m_lpUserFunctions);
004440D2 mov esi,esp
004440D4 mov eax,dword ptr [ebp-4]
004440D7 mov ecx,dword ptr [eax+0B8h]
004440DD push ecx
004440DE mov edx,dword ptr [ebp-4]
004440E1 mov eax,dword ptr [edx+0BCh]
004440E7 push eax
004440E8 mov ecx,dword ptr [ebp-10h]
004440EB push ecx
004440EC mov edx,dword ptr [ebp-8]
004440EF push edx
004440F0 mov eax,dword ptr [ebp-14h]
004440F3 push eax
004440F4 mov ecx,dword ptr [ebp-0Ch]
004440F7 push ecx
004440F8 mov edx,dword ptr [ebp-4]
004440FB call dword ptr [edx+0B0h] <== here access violation 0xC0000005
00444101 cmp esi,esp
00444103 call __chkesp (00451fa0)
00444108 mov dword ptr [ebp-11Ch],eax
327:
when failure edx+0B0h == 0x009796b0
009796b0:B0 D4 11 02 CD CD CD CD 38 7B 14 00 78 A4 14 00 00 00 11 02 CD CD CD CD 38 7B 14 00 78 A4 14 00
The address of func m_PFoo is 0x0211D4B0, it's all right.
What 's the problem with my program and how to fix it ?
Thank you very much !
|
|
|
|
|
I don't think you need that pointer to call the function since it's already a pointer, so 326 becomes:
retval = (m_PFoo)(infc, infv, exfc, exfv, m_lpDCL, m_lpUserFunctions);
|
|
|
|
|
Hello,
I have some questions about declare functions, when I declare a function,
what is the different between
const char* f();
and
char* const f();
Thank for your help!
Nachi
|
|
|
|
|
|
I am using a message box in my application. When it appears and I click OK, it hangs my application. I am running in debug mode, and I have to stop debugging to recover.
I would like to have a modeless message box where the user does NOT need to press any buttons in response to the message box. All the message box would do is notify the user that some event has occured. Can some one help me with such a message box?
Jerry
|
|
|
|
|
Not possibe to hae modeless message box, one thing you can do is press F5 and put a breakpoint after the messagebox.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Indeed, It is Possible,
You might have surfed CP..then you must have seen this stuff
"Balloon Help as a non-modal replacement for MessageBox() " by Shog 9
Just click this
URL http://www.codeproject.com/miscctrl/balloonhelp.asp?target=Balloon
regards
Balkrishna Talele
|
|
|
|
|
Did you realise that his program hangs when he is debuging the application? will you replace some implementation just because it is not functioning while steping through the code ???
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Indeed, It is Possible,
You might have surfed CP..then you must have seen this stuff
"Balloon Help as a non-modal replacement for MessageBox() " by Shog 9
Just click this
URL http://www.codeproject.com/miscctrl/balloonhelp.asp?target=Balloon
I think this is what you need....
regards
Balkrishna Talele
|
|
|
|
|
Hi
I want to create a msi package for a vc++ application. How can I create it from scratch
|
|
|
|
|
What is that "msi"?????????
|
|
|
|
|
MSI is windows installer file.
|
|
|
|
|
I paint on a dialog with an DC-Pointer (e.g. lines, circles, points...)
how to restore the dialog without the painted things. Is there an easy function that restors the old surface...?
|
|
|
|
|
Use a memory DC and take a snapshot of the surface using BitBlt may be, and then paint on the dialog. To restore surface, you just have to call BitBlt again, but this time using memory DC as the source.
Gurmeet S. Kochar
If you believe in God, it's because of the Devil
|
|
|
|
|
Hi all!
I've a problem, and I didn't find any solution for it anywhere.
I've a dialog based app, which creates a CPropertySheet when a button clicked. I add pages to the sheet, then I call its DoModal.
The pages are derived from CPropertyPage. I've special pages, those put another window objects onto the page in OnInitDialog (I get some HWNDs, and then call ::SetParent(child_hwnd,GetSafeHwnd().
The window objects all have the WS_CHILD style, so the setparent works fine, the newly added child windows appears on the pages.)
Everything goes fine until I press OK.
I've debugged a bit, and found out that the code hangs, when the CPropertySheet's DoModal reaches a SetActiveWindow call. (When it wants to set the parent window as the active window again).
I did a not too nice trick: the main dialog catches the WM_ACTIVATE and doesn't call the DefWindowProc while the PropertySheet is visible. It worked, but I think there is a better solution.
Thanks in advance!
|
|
|
|
|
Created and editable CListCtrl.
Trying to subclass CDateTimeCtrl - unable to handle using VK_TAB and forcing the subclassed control to lose focus and destroy itself.
Reasoning: When using the drop-down, obviously, CDateTimeCtrl loses focus, but can't figure out how to keep control visible until all user intervention is complete - or naturally, it loses focus to the next column, or other object.
I tried overiding OnKillFocus:
void CdtkDate::OnKillFocus(CWnd* pNewWnd)
{
CDateTimeCtrl::OnKillFocus(pNewWnd);
CMonthCalCtrl* pMonCalCtrl = this->GetMonthCalCtrl();
// But CMonthCalCtrl doesn't get focus until the user selects it,
// Even though it is visible - should I force this focus?
if(pNewWnd->m_hWnd == pMonCalCtrl->m_hWnd)
return;
DestroyWindow();
}
This Class will not always destroy itself - and I get an error when the application instance is terminated.
Any suggestions will be appreciated.
|
|
|
|
|
Hi,
The below works ok for resizing a control within a window but a side effect is that the when resizing the main window I have to left click the mouse again to release the resizer, how do I make it auto release? (it auto releases the resizer when not using MoveWindow)
Thanks,
HOBNOB
void CConcatDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
RECT r;
GetWindowRect(&r);
if(r.top!=0)
if(m_list) m_list.MoveWindow(0, 55, r.right-r.left-7, r.bottom-r.top-130,TRUE);
}
|
|
|
|
|
Some settings in ur windows, nothing wrong with the code.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Hello, the following code always crashes with "Error: Attempt to access invalid address".
void CServicesDlg::OnBstop() <br />
{<br />
TRACE("Services::OnBstop\n");<br />
<br />
DWORD dwError;<br />
int nSel = m_ctlListServices.GetSelectionMark();<br />
<br />
if(nSel == -1)<br />
{<br />
return;<br />
}<br />
else<br />
{<br />
TCHAR szService[BUFF_LEN];<br />
m_ctlListServices.GetItemText(nSel, 1, szService, BUFF_LEN);<br />
<br />
SC_HANDLE hSCM = OpenSCManager(m_strPCName, NULL, SC_MANAGER_ALL_ACCESS);<br />
if(hSCM == NULL)<br />
{<br />
dwError = GetLastError();<br />
ErrorDescription(dwError);<br />
AfxMessageBox("OpenSCManager failed");<br />
TRACE("Services:hSCM is NULL\n");<br />
return;<br />
}<br />
SC_HANDLE hService = OpenService(hSCM, szService, SERVICE_ALL_ACCESS);<br />
if(hService == NULL)<br />
{<br />
dwError = GetLastError();<br />
ErrorDescription(dwError);<br />
AfxMessageBox("OpenSCManager failed");<br />
TRACE("Services:hService is NULL\n");<br />
return;<br />
}<br />
<br />
if(ControlService(hService,SERVICE_CONTROL_STOP,NULL)==0)<br />
{<br />
dwError = GetLastError();<br />
ErrorDescription(dwError);<br />
}<br />
OnBrefresh();<br />
<br />
CloseServiceHandle(hService);<br />
CloseServiceHandle(hSCM);<br />
} <br />
}
My question is, where is the bug? ![Confused | :confused:](https://www.codeproject.com/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
I have a "user" type class with personal info in it which I wish to protect. I will use the Blowfish algorithm and I have two functions encrypt() and decrypt(). In my user class I used to serialize it to and from disk in plain text format using CArchive. What I can do is for each CString member of my user class I can encrypt each member before I serialize it or decrypt each member after I deserialize it.
I just want some opinion on what is the best way to do this. In some ways I think encrypting/decrypting each member (there are many members in the class) is not the best way. I wondered if I should encrypt/decrypt in one go in other words, when writing the file, I should write as plain text, then I should encrypt, or could I modify CArchive to do the encryption in a more logical manner?
Can anyone tell me how best to go about this because I want to not have lots of repetitive code to do the encryption and decryption.
|
|
|
|
|
I encrypt in memory then write to disk becuz if you write data to disk first then encrypt it, deleting your old file (unless you shred it first or encrypt over top original) it's then possible to undelete your original un-encrypted file. So I always encrypt in-memory before writting to disk.
Cheers
The word of the day is legs, let's go back to my house and spread the word ![Poke tongue | ;-P](https://www.codeproject.com/script/Forums/Images/smiley_tongue.gif)
|
|
|
|
|
Good point
I have now written my encryption code into my user class where I now think it belongs. I just pass my key to the user class and let that do the worrying about encryption.
|
|
|
|
|