|
The reason you are not getting good results is that very few books on C++ start with dialogs, forms and buttons. Almost all of them are console based and require you to learn enough of the CLI programming to get a feel for things. Once you know C++ you can go learn anything.
Concrete examples for you are CreateWindowEx() then look up hwnd and start handling messages that go to that window. Handling the messages that get sent to a window by it's hwnd is one way to get WM_MOUSEDOWN and WM_MOUSEUP these are WM_ WindowMessages google for them.
I'm saying way more than I should this being the lounge and all but with what I've put here you have more than enough ammunition to go forth and conquer using google.
If you search Win32Api you're going to get 1000's upon 1000's of examples.
- Rex
The enemy's gate is down.
Welcome to CP in your language. Post the unicode version in My CP Blog[^] now.
|
|
|
|
|
Bob X wrote: I figured I was missing something small, but I didn't know what it was, and I figured someone here would have a clue about what I was missing. I have googled, used msdn where I finally found something that wasn't very good, I have used the tutorials and help with VS2005 and they are absolutely horrible for me to use. Also reading through a 700+ pages in books isn't very efficient if I don't know exactly what I am looking for.
Then try this:
"To avoid asking a programming question in the lounge, it is obvious to me I am missing something in my attempts at handling forms in Visual C++. I posted without getting help here[^] as a reference, but now I am coming looking for what I need to fill in my gaps. I need a tutorial to help me since I am missing some basics, I have googled, I have searched MSDN, but if I don't know what I am looking for how can I find it?
I have .... and .... and .... but it still doesn't help. I don't want to waste my money on yet another book unless it will fill in the basics I am missing. Can anyone recommend a good starting book for doing Visual C++ forms/GUI design and building, please?"
as for the ... for Dummies books.... don't buy them. A) it is self-insulting B) there are far better intro tutorials. You can ask without breaking the rules.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Will try to put it so elegantly in the future.
Thanks.
|
|
|
|
|
Bob X wrote: Will try to put it so elegantly in the future.
actually, all I did was change your words from "tell me the answer" to "tell me where to find the answer for myself". You said you knew you were missing something small (basics) you said you had books and tried searching but they weren't helping.... All I did was paraphrase you.
"Give a man a fish and he will eat for a day. Teach him how to fish and he will eat for a lifetime."
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Jeffry J. Brickley wrote: All I did was paraphrase you.
Interesting...
|
|
|
|
|
Jon Sagara
Look at him. He runs like a Welshman. Doesn't he run like a Welshman? Doesn't he? I think he runs like a Welshman.
My Site | My Blog | My Articles
|
|
|
|
|
"I'm posting it here because I didn't get an answer elsewhere" is disrespectful. If everyone says "I know this is a programming question, but" then the lounge will turn into the local dumping ground for the impatient or lazy.
Moved to the C++ forum.
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
Chris Maunder wrote: "I'm posting it here because I didn't get an answer elsewhere" is disrespectful.
Sorry for being disrespectful. It was not my intent.
|
|
|
|
|
I'm trying to create an activex project with 2 controls. The first is the primary control. The second loads some data and the idea behind it is to call a couple of methods within the first to set some features.
The idea behind this is so if there are multiple instances of the main control each one created doesn't have to load the data as that seems less than optimum for performance.
I tried creating a method within the secondary control which has a parameter defined as the first controls class. It compiled ok but when utilizing the two controls calling that method with the primary control as the first parameter doesn't work.
I'm guessing this is because the class isn't actually the control. My question is it possible to pass a control as a parameter in a method.
If so how do I do it?
Thanks
Stewart
|
|
|
|
|
Hi, I am having errors.
error C2664: 'Menu::createMenuItem' : cannot convert parameter 3 from 'std::_Vb_reference<_MycontTy> *__w64 ' to 'bool *'
...
vector<bool> connect_flags;
vector<bool> disconnect_flags;
...
for(int j=0;j<gmenustate.getsizeofgosafestations();j++)
{
this-="">pMenu->createMenuItem(mhComm, (connect_str+gMenuState.getGosafeStation(j).name).c_str(),
&(gMenuState.connect_flags[j]), &_menuHeaderCommFn);
this->pMenu->createMenuItem(mhComm, (disconnect_str+gMenuState.getGosafeStation(j).name).c_str(),
&(gMenuState.disconnect_flags[j]), &_menuHeaderCommFn);
}
Anybody can help me?
Yonggoo
-- modified at 18:51 Thursday 13th April, 2006
|
|
|
|
|
Hey everyone:
I'd like to kill the scrollbar that appears on my screensaver window when I'm using http://www.codeproject.com/com/cwebpage.asp. I try calling ShowScrollBar(hWnd, SB_BOTH, false); for the hWnd to the screensaver with no results.... any idea why?
Thanks!
|
|
|
|
|
|
Can one help me in knowing Which part of the O.S Supports Multithreading?
Thank u
Fly Like An Eagle With MIGHTY POWER.
|
|
|
|
|
|
satishvarma_e wrote: Which part of the O.S Supports Multithreading?
, exactky what you want to accomplish
|
|
|
|
|
Hello,
I am having a proglem with "First-chance exception" when displaying a CFileDialog...
Here is the code I am using to display the dialog.
void CExcludeDlg::OnBnClickedBImport()
{
UpdateData(TRUE);
static char BASED_CODE szFilter[] = _T("Text File (*.txt)|*.txt||");
CFileDialog m_ldFile(TRUE, _T(".txt"), NULL, OFN_HIDEREADONLY, szFilter);
if (m_ldFile.DoModal() == IDOK)
{
CWaitCursor c;
CString strFilePath = m_ldFile.GetPathName(),
strLine = _T("");
CStdioFile file(strFilePath, CFile::modeRead | CFile::shareDenyNone);
while(file.ReadString(strLine))
{
BOOL bFound = FALSE;
strLine.Trim();
POSITION pos = m_strStringList.GetHeadPosition();
while(pos)
{
if(!strLine.CompareNoCase(m_strStringList.GetAt(pos)))
bFound = TRUE;
m_strStringList.GetNext(pos);
}
if(!bFound)
m_strStringList.AddTail(strLine);
}
m_strList.Empty();
POSITION pos = m_strStringList.GetHeadPosition();
while(pos)
{
m_strList += (m_strStringList.GetAt(pos) + _T("\r\n"));
m_strStringList.GetNext(pos);
}
m_strStatus.Format(_T("Count: %d"), m_strStringList.GetCount());
}
UpdateData(FALSE);
}
Here is the error in debug mode.
First-chance exception at 0x7ca51406 in SiteConsole.exe: 0xC0000005: Access violation reading location 0x016d49c8.
Unhandled exception at 0x7ca51406 in SiteConsole.exe: 0xC0000005: Access violation reading location 0x016d49c8.
Here is the disassembly point where it breaks.
7CA51406 mov ecx,dword ptr [eax]
Any ideas??
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Does the problem happen before or after the DoModal() call?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I'm not sure.. I have remarked everything out in the code except the construction, DoModal and GetFileName and it takes between 2 and 10 times of opening the dialog and clicking OK before it will crash.
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
RobJones wrote: ...it takes between 2 and 10 times of opening the dialog and clicking OK before it will crash.
Which OK button, the one on your dialog, or the one on the File Open dialog?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Sorry I ment to say the 'Open' button on the CFileDialog..
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
It appears that m_ldFile.GetPathName() is causing the issue...
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
So if you commented out everything in between these two statements, would the exception persist:
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Yeah, I think the part that is actually throwing the exception is m_ldFile.GetPathName() but I don't know why. The following trows the exception but if I remark out the m_ldFile.GetPathName() the exception stops.
static char BASED_CODE szFilter[] = _T("Text File (*.txt)|*.txt||");
CFileDialog m_ldFile(TRUE, _T(".txt"), NULL, OFN_HIDEREADONLY, szFilter);
if (m_ldFile.DoModal() == IDOK)
{
CString strFilePath = m_ldFile.GetPathName();
}
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
RobJones wrote: CString strFilePath = m_ldFile.GetPathName();
You might put a breakpoint on this statement and step into the GetPathName() method to get the exception narrowed down a bit further.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
If you are using Visual Studio 8, enable breaking on first change exceptions in the debugger.
You can do that by going to Debug->Exceptions, expanding the Win32 Exceptions node and marking the ones you care about.
This will let the debugger stop where it's happening so you can narrow down the probelm.
gmileka
|
|
|
|