|
Hi everyone,
I am looking for a tutorial that discusses GUI component creation in C++ and packaging it as DLL. Can anyone with some experience point me to a good website or recommend a good book for this.
Thanks,
Sincerely,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Do you want a normal MFC DLL or a COM component?
For MFC DLL, here is one good resource.
http://www.mindcracker.com/mindcracker/c_cafe/dll.asp
Kuphryn
|
|
|
|
|
Hi,
Actually I was looking for a DLL that does not use MFC. Do you know any such component DLL examples?
Thanks for your reply.
Sincerely,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
hi,
I am a novice to Windows programming. I have been mainly exposed to a unix
environment so far. I need to parse a file to generate a C++ header file
that can be used again the C++ code.
Specifically, I have to generate a function to convert a string value to its enum.
So,
enum numbers = {zero,one, two, three};
numbers temp = StringToEnum("zero"); // StringToEnum() should return the integer 0;
I want to maintain one file for the enum (its really big ) and generate a file
containing the function for StringToEnum()). This new file can then be used to compile
other code. Typically, I would do this by writing a shell script in unix followed by
appropriate changes to the makefile.
I am new to a Windows environment.
Can anyone please tell me how to achieve this in VC++ ( what scripting language,
if at all can I use and if there is any way I can set options to generate the C++
file that contains the function on the fly prior to compilation ).
Thanks and regards,
-sharath.
Sharath.
|
|
|
|
|
Hi,
I'm a beginner with VC++ 6.x and I'm becoming crazy. I don't know how to manage several group of radio buttons on the same dialog box... it seems that evey radio buttons are included in the same unique group !
Any ideas ???
thanks !
|
|
|
|
|
In short, radio buttons are lumped together by their WS_GROUP style.
In the old days, you could do something like:
CheckRadioButton (hDlg, IDC_FIRSTONE, IDC_LASTONE, idCheckedOne);
CheckRadioButton (hDlg, IDC_FIRSTTWO, IDC_LASTTWO, idCheckedTwo);
But you would have to make sure you had non overlapping ids. It was also
a pain to find out which button was set in each group.
You can now use
DDX_Radio (pDX, IDC_FIRSTONE, nCheckOne);
DDX_Radio (pDX, IDC_FIRSTTWO, nCheckTwo);
in your CMyDlg::DoDataExchange method.
To associate buttons in a group together, first make sure every control in
your dialog has the group style bit checked. Then set the tab order (ctrl-d)
so that successive radio buttons have successive order. Last but not least
clear the group style bit for all radio buttons except the first in each
group.
Good luck,
Iain.
|
|
|
|
|
That's it ! so hard to find such information in the Visual C++ documentation... it saves me a lot of time !
Many thanks
|
|
|
|
|
someobject *var=new someobject[100];
delete var;
----------------
someobject *var=new someobject[100];
var=null;
---------------
what is the difference betn these two statements?
|
|
|
|
|
I'm not sure, but I think that
someobject *var=new someobject[100];
delete var;
frees alocated memory
and
someobject *var=new someobject[100];
var=null;
changes the pointer to null
|
|
|
|
|
Does that mean, when the pointer is made null,
the memory it pointed to also gets freed.
can "var=null" be used inplace of "delete var;" ?!!
|
|
|
|
|
No, as C++ is not garbage collected var=NULL is probably an error and generates a leak in your application. Nobody will take care of the memory you leave behind undeleted. This doesn't necessarily mean a memory leak if var points to some memory block that is also pointed to by some other pointer, and you properly delete that.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
"var=NULL" is NOT the same as "delete var".
If you imagine that
BYTE *var= new BYTE [100]<pre>
allocates a lump of memory for your use (it may be longer than 100 bytes long) and sets
var to point to it.
<pre>var=NULL;
simply makes your variable point "nowhere". The memory is still allocated.
delete [] var;
frees the memory, but your variable is still pointing to the now freed patch or memory.
You could still use it, but not safely. Note the [] in the delete command as you
are freeing an array.
You should be doing something like:
BYTE *var = new BYTE [100];
...
delete [] var;
var = NULL;
Pointers are one of those things you struggle with for a while then wake up one morning
going "Ahah!"
Iain.
|
|
|
|
|
Thanks guys!!
That was tremenodus response in no time at all.
You're all great.
Life is so much easier with you.
God Bless All.
|
|
|
|
|
Hi, everyone!
I want to implement a mini-TCP protocol that can simulate
TCP's three-time shake hands method and simulate simple
"send" and "recv" method in socket programming. I want to
use raw socket but I am not sure whether there are some
alternative methods.
I just want to get simple implementions to make a concept
proof purpose of how TCP is working. Just for learning purpose.
I want to know whether there are some sample codes of this
topic that I can make a reference? Must I use RAW SOCKET?
Are there some alterative methods or alternative methods?
Thanks in advance,
George
|
|
|
|
|
Hi,
I need to change the title of a dialog box, this is what I have tried:-
<code>
CDlgCal dlgCal(this);
dlgCal.SetWindowText("Step to something");
if(dlgCal.DoModal()==IDOK)
{
blah blah blah .....
}
</code>
But I get this ASSERT error when it runs ....
<b>ASSERT(::IsWindow(m_hWnd));</b>
Any ideas?
Thanks.
Ali
|
|
|
|
|
The window hasn't been created at this point, only the object that will be managing the window.
You need to handle the WM_INITDIALOG message and call SetWindowText() then.
Software is everything. It also sucks. Charles Fishman [^]
Awasu 1.0.2 (beta)[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Yes it's because your window doesn't exist when you call the SetWindowText function. It's better to change the text in the OnInitDialog() overloaded member function.
|
|
|
|
|
You have to do the SetWindowText inside the OnInitDialog (or later)...
The problem with Modal Windows dialogs is the Win32 Window is created & destroyed in DoModal(), i.e. it does not exist before the call.
Since MFC is supposed to be a "light wrapper", it doesn't do the same level of abstraciton as .NET or (shudder) VB.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
The assertion comes because you try to set the text before the dialog is created with DoModal(), so the dialog has no handle, and the API function fails.
To do it properly, go in the CDlgCal::OnInitDialog() (Override the WM_INITDIALOG message if you do not have that function present in the class browser), and put your code in this function. i.e. :
... CDialog::OnInitDialog(...bla...)
{
...
SetWindowText("Step to something");
...
}
~RaGE();
|
|
|
|
|
Thanks guys - for the replies - there are some nice expainations there. I've moved my 'SetWindowText' call and its all working fine now.
Thanks again, Ali.
Ali
|
|
|
|
|
hi,
i've developed a program that puts a struct into a linked list... Wenn i put the new record into my list, and i read it after that, the program crashes(wenn getting the CString)...
the problem is that my list is not updated at all... if i read a number that is inserted with the value 3, it has the value -2421523832 wenn retreiving it...
now i want to know how to update my list, not that i don't know it at all but my way is not working.
i get the pointer(Leverancier) to my struct in the function that updates the list...
<br />
NewLeverancier = new CLeverancierStruct;<br />
NewLeverancier = Leverancier;<br />
m_LeveranciersLijst.AddTail(NewLeverancier);<br />
should this work?
[]D [] []D []
|
|
|
|
|
Hi Willen,
I asked this very question a couple of days ago. Didn't you undesrstand my reply? If so, I'll gladly try to make myself clearer, if you're so kind as to tell me what you didn't get.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
well it didn't work...
i made the the struct then i send the pointer to that struct towards the function to safe it in the list... than after that i just want to put it into the linked list...
so: you say i have to do this:
<br />
<small>NewLeverancier = new CLeverancierStruct(*Leverancier );<br />
m_LeveranciersLijst.AddTail(NewLeverancier);</small>
[]D [] []D []
|
|
|
|
|
okey, i tried it one more time, and it does copy the values of the struct but the problem with the CString still remains....
[]D [] []D []
|
|
|
|
|
oke...
I'm getting pretty crazy here... it was all a compiler fault... i rebuilt my hole project and guess what: problem solved.... damn those debug files....
thanx for helping me out...
[]D [] []D []
|
|
|
|