|
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?
|
|
|
|
|
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
|
|
|
|
|
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.
|
|
|
|
|
The application that I am working on has a view with base class CListView. When I click on an item in the list, I change the state mask.
i.e.
lvi.state = INDEXTOSTATEIMAGEMASK(n);
Then, I update the list.
I would like to scroll to the item in the list which I have just changed. I have tried GetScrollInfo and SetScrollInfo. This moves the scroll bar to the specified position but the list view does not scroll (remains at top).
How do I scroll the view with the scrollbar?
Any advise which can help me understand this method is greatly appreciated.
|
|
|
|
|
Incredibly, after several evenings bashing my head on this problem, I found the answer directly after submitting my question. I have found that I only needed to use the method EnsureVisible.
Thanks to anyone who took time to read my dumb question. Any further advise is certainly welcome.
|
|
|
|
|
I do this same thing all the time
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
What is the fasted way to swap bytes in a ushort/ulong?
For example:
0x1234 -> 0x3412
0x12345678 -> 0x78563412
unsigned short short_exch(const unsigned short a)
{
return (a << 8) + (a >> 8);
};
unsigned long long_exch(unsigned long a)
{
unsigned long t = a&0xff;
a >>= 8;
t <<= 8;
t += a&0xff;
a >>= 8;
t <<= 8;
t += a&0xff;
a >>= 8;
t <<= 8;
return t + a;
};
Jürgen Eidt
http://cpicture.de/en
|
|
|
|