|
hi
please read one c++ book atleast and then ask the questions..
CodeTheDreams();
|
|
|
|
|
|
|
It is a custom datataype in C++.
|
|
|
|
|
A class is the declaration of an object.
Let's imagine a button; a button have a color, a text, sometimes an image, and a function that gets signaled when the user clicks it...
A button is an object.
The declaration of a button would be (in easy terms) :
class CButton
{
COLORREF color;
CString csText;
CBtimap bmpImage;
void Onclick();
}
OK, now you have that class declarated, and now it's the time to use it in your code.
In your code you can instantiate (once you have your class declared you can define it everywhere where it is known).
Each time you need to use the class (the button in this case) you'll be declaring objects of that class (instantiating them) in this way:
in the Header file of your XXX dialog you could write:
...
private:
CButton m_mybutton;
...
and in your dialog initdialog function:
...
m_mybutton.color = 12344;
m_mybutton.text = "hello"
...
...
ow it's time to read a book of cpp and to learn how it really works, but this should be a good starting point...
Hope this helps.
|
|
|
|
|
I'm trying to mimick the 'arrange icons by...' as seen in explorer in my CListView based app.
I've looked up the method to implement this on msdn and have implemented my sort routine. So far so good...
The problem I have is that in mY sort function (compare function) I always receive the first record (0) of my listview to compare.
Some code snippits to explain:
void CMylistView::OnViewBydescr() <br />
{<br />
<br />
CListCtrl* m_cListCtrl;<br />
m_cListCtrl=&GetListCtrl();<br />
m_cListCtrl->SortItems(SortFunction, (LPARAM)(m_cListCtrl));<br />
}
int CALLBACK CMylistView::SortFunction(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)<br />
{<br />
CListCtrl* pListCtrl = (CListCtrl*) lParamSort;<br />
CString strItem1 = pListCtrl->GetItemText(lParam1, 0);<br />
CString strItem2 = pListCtrl->GetItemText(lParam2, 0);<br />
return strcmp(strItem1, strItem2);<br />
}
|
|
|
|
|
Solved it!
I changed
m_cListCtrl->SortItems(SortFunction, (LPARAM)(m_cListCtrl));
into
ListView_SortItemsEx(GetSafeHwnd(), SortFunction, (LPARAM) this);
But why doesn't the m_cListCtrl->SortItems doesn't work
Wim
|
|
|
|
|
Two problems. First, change
SortItems ( SortFunction, (LPARAM) m_cListCtrl ) to
SortItems ( SortFunction, (LPARAM) &m_cListCtrl )
Second, you are thinking lParam1 and lParam2 are the item indexes, but they are not, they are the lParam data associated with the two items being compared. They are always 0 because you probably don't use those data members.
--Mike--
PROCRASTINATION: Hard work often pays off after time, but laziness always pays off now.
BUY MY SOFTWARE!! (please?) RightClick-Encrypt - file encryption w/Explorer plugins | 1ClickPicGrabber - web page picture grabber for IE
My IntarWeb Homepgae!!!11
|
|
|
|
|
hi!
how can i use a c# (.net) control in mfc? is this possible?
|
|
|
|
|
Okay, I also made another version of my program... Unfortunatly it won't compile and it gives me this wierd error:
LINK : fatal error LNK1104: cannot open file "nafxcwd.lib"
I don't know why... Anyways, Im betting its because the lib file isn't linked again btu hey Ive nver seen it before...
Any help would be appreciated.
orcblood
|
|
|
|
|
Oh I should say that I made it with C++ and not MFC!
orcblood
|
|
|
|
|
I have seen those types of errors before - you need to check out your project settings.
Make sure all projects and .libs you include in your project have the same setting in the C++ tab under "Code Generation" - they should all be "Multithreaded Debug" for debug mode, or "Multithreaded Release" for release mode. You could ahve them all "Single threaded" too. You can't mix debug and release, nor should you mix single and mulitithreaded.
Give that a go and see what happens. Also, try the obvious, do a "Clean" and then rebuild it.
You can pick your friends, and you can pick your nose, but you can't pick your friend's nose.
|
|
|
|
|
Okay, I made a simple MFC app that just opens and closes dialogs and all that . However I have one small problem. I send it to someone else's comp and it gives them an error:
A required .DLL file, MFC42D.DLL, was not found
Anyone know why this is? Do I have to dig up this dll out of the MSVC++ folder and send it along with the program? Ive tried it on 3 different comps and eachone gives me the same error... Does anyone know how to fix this?
Thanks, Ive never made a program with MFC before so maybe this is why its not working.
orcblood
|
|
|
|
|
You are distributing the debug version of your app. Rebuild it as "MFC Release" and re-distribute it.
Frank
|
|
|
|
|
How do I do that? Lol Im a newbie at it .
orcblood
|
|
|
|
|
Build Menu -> Set Active Configuration -> Click Win32 Release -> ok -> rebuild All.
Frank
|
|
|
|
|
The easiest thing to do is to go to the Project menu and select Settings.... Then go to the General tab and select the Use MFC in a Static Library option.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
It only has Use MFC in a Shared DLL option...
orcblood
|
|
|
|
|
Okay, now it gives me two compiling errors:
AVI PlayerDlg.obj : error LNK2001: unresolved external symbol _MCIWndCreateA
Release/AVI Player.exe : fatal error LNK1120: 1 unresolved externals
Thanks, I know mroe now lol.
orcblood
|
|
|
|
|
You are getting this error because the linker doesnt know where to find the symbol _MCIWndCreateA.
MSDN documentation says that MCIWndCreate function links to vfw32.lib. Try putting that in your linker options as a required library.
Project -> Settings -> Select "Settings for: All Configurations" -> Link Tab
Put "vfw32.lib" in the box for "object library modules". Then rebuild.
Frank
|
|
|
|
|
Oh thank you soo much guys! It works now woohoo! It also works on other people's comps .
orcblood
|
|
|
|
|
orcblood wrote:
It only has Use MFC in a Shared DLL option...
You have the learning edition of VC (or whatever it's called, I forget the exact name) which doesn't let you link statically with MFC. But as you've found out, most folks have mfc42.dll already, so your release version works.
--Mike--
PROCRASTINATION: Hard work often pays off after time, but laziness always pays off now.
BUY MY SOFTWARE!! (please?) RightClick-Encrypt - file encryption w/Explorer plugins | 1ClickPicGrabber - web page picture grabber for IE
My IntarWeb Homepgae!!!11
|
|
|
|
|
I want to add my program.exe as a service in windows 2000. Are there any tutorials for doing this either manually or progrmatically.
any help appreciated
George W
Software Developer
www.zsystems.ca
|
|
|
|
|
|
This is the situation:
My computer connects to the internet through gateway software (Wingate) on another computer that is directly connected to the internet. So there is a client application on my computer and a server application on the server computer.
Now the problem is this, i need to make a sort of firewall, but the thing is i cant use a normal firewall because it would just block out the server and i wouldnt be able to do anything anymore (since the connections are routed via the server). The thing i want to do is to filter all the packets that arrive on my computer before they are passed to applications, and even remove them if possible. I have some ideas on how to start but nothing concrete so i would appreciate some advice.
Thanks
Kuniva
--------------------------------------------
|
|
|
|