|
A map is a key-value containter. The point of a map is to sort by key and look-up items according to their keys. You may use a second map with first one's values as keys and depending on the situation you use either of them.
Best regards,
Alexandru Savescu
|
|
|
|
|
Okay. Thanks.
The algorithm I am working on a probably simple for most programmers. Nonetheless, I want to come up with my own solution instead of posting it and have someone else solve it.
I have implemented a working solution.
Hey, I always appreciate help from members. Sorry about the late reply. CodeProject server was down yesterday evening.
Kuphryn
|
|
|
|
|
When I set the editbox to read-only, its backgroud color will be gray. Can I set it to another color?
Thanks in advance.
|
|
|
|
|
Try to chenge the backcolor with the Erase Background message....
Best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
You can!!
handle the WM_CTLCOLOR message and check if the handle of the window passed to the handler function is equal to the handle of the editbox whose colour you want to change.
Then set the handle hbr to the brush you want to use as your background. Call SetBkColor() to change the background colour used when painting your text.
Look up WM_CTLCOLOR in MSDN!!
hope this helps
Adam.
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
|
|
|
|
|
I have tried to handle the WM_CTLCOLOR message, but failed. When the editbox is set to read-only, it will not send the WM_CTLCOLOR to its parent window.
Anyway, thanks a lot.
|
|
|
|
|
Hmm.. I am doing the same... the following code paints a white background in IDC_USER and IDC_KEY which are read only (I didn't want them to be gray) and paints everything else with a blue background. They are Enabled though (i.e. EnableWindow(TRUE)).
HBRUSH CCncloginDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
HWND hWnd=pWnd->GetSafeHwnd();<br />
if(nCtlColor==CTLCOLOR_EDIT || hWnd==GetDlgItem(IDC_USER)->GetSafeHwnd() || hWnd==GetDlgItem(IDC_KEY)->GetSafeHwnd())<br />
{<br />
pDC->SetBkColor(RGB(255,255,255));<br />
hbr=(HBRUSH)m_brBrush;<br />
}<br />
else<br />
{<br />
pDC->SetBkColor(RGB(128,128,200));<br />
hbr=(HBRUSH)m_brBrush2;<br />
}<br />
return hbr;<br />
}
Sounds mysterious! If you work out what's up then post it. I would be interested to hear what it was.
Adam.
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
|
|
|
|
|
How do I initialize the dialog's list box in the View's member function ?
Actually, I want to display a record in the listbox in the view button down handler fucntion?
When I try to do, my program aborts in the listbox.AddString(...) fucntion?
What could be possible wrong?
|
|
|
|
|
Sounds like the listbox hasn't been created yet. If the listbox is within a dialog class, you shouldn't initialise it until you receive a WM_INITDIALOG message - the OnInitDialog() method is called. So, in this case you could pass the relevant information to the dialog constructor, and then in the OnInitDialog() method of the dialog class, initialise the listbox there.
Dave
|
|
|
|
|
Yes, u are correct.
But I would like to initailize with the data I read from the database. I am reading the records in the View's member function, so how do i pass the values read to the listbox?
|
|
|
|
|
The same principle applies:
Something like:
void CMyView::DoSomething()
{
CMyDialog dlg( this );
for ( each value in database )
{
CString strValue = GetValueFromDataBase();
dlg.AddValue( strValue );
}
if ( IDOK == dlg.DoModal() )
{
// Do something with it
}
else
{
// Panic / shoot user
}
}
class CMyDialog : public CDialog
{
// All the usual stuff
public:
void AddValue(const CString& strValue);
private:
CStringList m_lstValues;
};
void CMyDialog::AddValue(const CString& strValue)
{
m_lstValues.AddTail( strValue );
}
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// Add the values
for ( POSITION pos = m_lstValues.GetHeadPosition() ; pos != NULL ; )
m_lstCtrl.AddString( m_lstValues.GetNext( pos ) );
return TRUE;
}
Dave
|
|
|
|
|
I have a standard window which I use as a aplitter. I want to give the window a beveled look like you get in VC++. I am trapping the WM_PAINT message to draw my own customized window but I dont have any idea ho to get the beveled look like VC++ splitter. What technique should I use to do that. I am not using MFC. Please help.
Also can somebody suggest me any help how to draw XP style menu using Win32.
Thanks in advance
|
|
|
|
|
checkout the DrawEdge() gdi function.
|
|
|
|
|
Hey Folks,
I just got off the phone with the security guy of a large american company who uses our product, who requires that our product transmit data "encrypted" through the pipes.
Currently, our Client-Server application has no encryption whatsoever, when a user logs into our server, the client sends the MD5 hash of the password to the server to be verified, yadda, yadda.
Our customer only requires the logon to be encrypted (the actual data being stored in our product isn't all that sensitive), which makes life easier, but in time, who knows, another customer MAY want the entire session to be encrypted.
With all this stuff new to me for the most part, I did some looking around, and found that CryptoAPI is included in Win2000 etc. Problem is, our product has to run on older platforms too... 95/98/98/NT/2K/XP... Does anyone have any suggestions?
Thanks,
Mike.
|
|
|
|
|
Use Crypto++[^]: robust, lots of documentation, freeware, no export restrictions... it has it all!
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
When i press a button in my program, i get this message:
Unhandled exception at 0x00ef86a6 in MP3.exe: 0xC0000005: Access violation reading location 0x00000110.
And the strange part is that I get this message even before it has executed any of the procedures for the event of that button. It hasn't even come to the case line
case IDC_CONVERT:
When it pops up with the message.
This only happens if I, before I press the button, press another button which prompts the user to choose an ACM compressor driver. Anyone know what could be wrong? Why does it try to read the location 0x00000110, is that normal?
Here's the assembly code I get redirected to:
00EF86A0 push esi
00EF86A1 mov esi,dword ptr [esp+8]
00EF86A5 push edi
00EF86A6 mov edi,dword ptr [esi+110h] <---- THIS LINE
00EF86AC cmp dword ptr [edi],0FFF88E3Bh
00EF86B2 je 00EF86BC
00EF86B4 pop edi
00EF86B5 mov eax,0FFFFFFFDh
It jumps to the line marked with "THIS LINE".
The value of edi is 24653 and the value of esi and eax is 0.
Please help, I have no idea what could be wrong.
Thankyou in advance.
-Rune Svendsen
|
|
|
|
|
Rune Svendsen wrote:
Unhandled exception at 0x00ef86a6 in MP3.exe: 0xC0000005: Access violation reading location 0x00000110.
Probably one of yout pointers is NULL. You should guard against it.
Use the call stack to find out which of your functions was called last and start from there.
|
|
|
|
|
This one has me totally stumped. How do I hook up the resources for an Extension DLL that in turn calls another Extension DLL? I have tried setting afxCurrentResourceHandle and others. It appears the main problem is the lack of a CWinApp object. I am trying to access some Dialog resources and of course any DoModal loop will fail due to lack of an initialized CWinApp object. This is an ATL exe Server built using CExeModule.
Any help would surely be appreciated.
|
|
|
|
|
You can use extension-style DLL only if .exe links with .dll version of MFC as well. It seems your exe server doesn't.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
Thanks for the reply!
It sounds as though my solution would be to create a Regular DLL and export a function that will create the class objects in the Extension DLL. Do you agree with this?
|
|
|
|
|
I'm not sure about the structure of your project. Your COM objects are created by the ATL-based .exe server. What's the role of DLLs? What kind of services are they providing?
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
Hi Tomasz,
The role of the Exe server is to handle special OPC scanning/communications with a Control System. The Server is designed to run standalone and execute scheduled scan tasks using OPC, but we now have to implement automatic generation of report files that are normally done manually by a user using a client connected to this Server. The report generation objects are located in MFC Extension DLL's that are currently being used by client apps. The need is to execute the existing report objects in the background with hidden windows. My only problem is getting the resource chain initialized properly and I believe your solution to call a Regular DLL will work since it will initialize its own CWinApp object.
Best Regards,
Bill
|
|
|
|
|
Hi.
I have two questions about a dialog based app.
1) How do you add an "About" menu item? For example, a dialog based app features an About class by default. I added a "File" menu. However, the "About" menu does not show up. I could add an "About" menu item, but how do you connect the menu command to the "About" window. In other words, how do you draw the "About" window as the user selects "About?"
2) When you create a dialog based app, AppWizard gives the options to have minimize, maximize, etc. Is there a way to add and/or remove one or more of those features using code? I did not add a feature to minimize, however, now I want to minimize the window. It is too late to use AppWizard.
Thanks,
Kuphryn
|
|
|
|
|
the default code built in is a message handler in the applications .cpp:
BEGIN_MESSAGE_MAP(CMyApp, CWinApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
END_MESSAGE_MAP() and then a function which handles it:
void CMyApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
} of course you have to declare this function in the app's .h file..
not sure about the 2nd question.
-dz
|
|
|
|
|