|
And how can he get rid of the 200 tests conditions by using a switch ?
|
|
|
|
|
Open the resource file and give adjacent Id's for your controls. This, way, you can simply do something like this:
SetDlgItemText(IDC_FIRST_CTRL_ID+i,sString);
|
|
|
|
|
Two things you could do here.
Use a switch statement
<br />
switch i<br />
{<br />
case 1:<br />
break;<br />
case 2:<br />
break;<br />
}<br />
but I wouldn't recommend that if you really have 200 fields and 200 controls on your dialog. If that's the case the easiest way is to ensure the values of your control id's are sequential and then do something like this
<br />
for(i=0;i<no_field;i++)<br />
{<br />
rs.GetFieldValue(i,sString);<br />
SetDlgItemText( BASE_FIELD_CONTROL_ID + i, sString);<br />
sString.Empty();<br />
rs.MoveNext();<br />
}<br />
you might want to use different ranges based on field/control types and use a switch to change the SetDlgItemText call.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks for reply ....
I follow second method... give the control adjacent
like IDC_CONTROL , IDC_CONTROL+1, IDC_CONTROL+2, and so on...
and i am very near to solve problem...
Thanks again for reply to all's
Note : Is it possible for me to get control handle at run time.
Regard's
Kaushik
|
|
|
|
|
Hi all,
Actually i want to give my exe, version number, copyright information dynamically. Is it poosible to do so.....
|
|
|
|
|
How dynamic is "dynamically"?
Here, our build-server includes a small, generated file with a version resource in the main resources of the project.
That way, the version number is set automagically.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
you mean the stuff that shows up in the Explorer Properties page after you right-click on the EXE's icon ?
no, that's not possible.
that stuff comes from examining the EXE file directly, not from executing the EXE in any way.
|
|
|
|
|
pls help me...
I am connecting a webcam to my computer thorugh usb port.can anybody help me to write a code in vc++ or c++ to check whether the camera is connected or not.
|
|
|
|
|
hi all.,
as part of my MFC app i have to write data into CD ROM., for that i got code form Microsoft , it is purly in win 32 -SDK, fine
they have used "Imapi.h" header file form SDK, but i dont have latest version of SDK in my XP machine, but i installed SP2, i try to download form Microsoft., fine
but i was not able to install the version of SDK,
can any one help me to get latest version of SDK (XP) or if any one have "imapi.h" header file, just send it to me
thanks
shiva
|
|
|
|
|
|
palanirajan wrote: if any one have "imapi.h" header file, just send it to me
That's stupid. What will you do with a header file but no correct library file ?
The only correct thing to do is to download the required platform SDK from microsoft. So, what problem are you having there ?
|
|
|
|
|
hi everyone.....
am having my icon in system tray.......
if i right click the icon there should be some options...
how to add right click functions?
can help anyone?
thangs....
regards,
Paul.G
paulraj
|
|
|
|
|
If you are Win32 or not but you can make new resoure in which you can create new Menu and you can add it to that icon.
You can process that menu items by making window procedure to handle those menu messages.
|
|
|
|
|
hi...
can you tell somewhat briefly...
paulraj
|
|
|
|
|
|
When you add your tray icon with Shell_NotifyIcon(), specify
a window handle and a callback message along with the NIF_MESSAGE
flag.
When the window receives that message, check the LPARAM
for WM_RBUTTONUP or WM_CONTEXTMENU. If you receive the
message you want, you can use TrackPopupMenu to show a menu, or
display some other kind of UI.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm a Windows programmer and use MFC heavily. But in many forum/newsgroup STL seems to be a must have for a c++ programmer.
So I'm curious that should I use STL or MFC's array/list in my project?
STL seems to be a standard, but MFC's array/list fit in the MFC structure well.
|
|
|
|
|
MFC containers are crap, they were a stopgap until they had STL in their compiler, and remained as a legacy support thing. They should never be used unless you have a compelling reason, you should use STL by default.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Here are some performance readings which i took for CArray and std::vector
Time taken to add 1 million elements( unsigned long )
CArray = 2.7360s ( 2736 ms ) //Will be faster if you set the size using SetSize()
vector = 0.0210s ( 21 ms ) //Will be faster if you set the size using reserve()
CList = 0.0260s ( 26 ms )
std::list = 0.1220 ( 122 ms )
CMap = 0.0820 ( 82 ms ) // Used InitHashTable( 200017 ) or else it will take ages to add elements
stl::map = 0.0399 ( 399 ms )
Though STL is not as well structured or as easy to use as MFC but performance wise they win hands down.
Note: Will using STL access the elements using iterators. It will be very fast.
|
|
|
|
|
I'm first decoding, then encoding a .MP3 format. But it is not working properly. I wanna know how can we use avcodec to encode or decode a audio or video file?
Any help would be highly appreciated.
Come online at:-
jubinc@skype
|
|
|
|
|
I know static class member method(or function) doesn't have this pointer, we should use static class member method like this:
<br />
CMyClass::staticMethod();<br />
but sometimes we'll forget it's a static class member method and do some miscorrect use like ordinary methods:
<br />
CMyClass obj;<br />
obj.staticMethod();<br />
Question NO.1:
Why doesn't the compiler tell me the errors?
Question NO.2:
If the compiler doesn't tell me these codes, do these code harm?
Question NO.3:
Why can't Search Message Boards by user now? I remember it could do so before this update of CP, I'd like to Search Message Boards by user to find if anybody answers my question before.
|
|
|
|
|
1 and 2) Because it's perfectly legal to call a static function on a class instance. There's nothing wrong with it, and the code won't harm .
|
|
|
|
|
Hello ..
can somebody help me in ..
Scenario ::
for the Image data processing i write code in c++ where the
pBuffer have the image data
unsigned char * pBuffer ;
pBuffer = new unsigned char[someSize];
// Did Some processsing by copying the data in pBuffer
Now finally Wrote the data from pBuffer. just after that i tried to release the memory.. for that
if(pBuffer != NULL)
delete pBuffer;
For the single run it does not give me any error but consequently if i ran for second Image it gives me
Debug Error !!
DAMAGE : After Normal block (#8081)at some address
please help me ..!!
Thanks in advance
Shikha
|
|
|
|
|
plz try to delete Buffer using....
delete [] pBuffer;
Just try this.
thanks.
|
|
|
|
|
Thanks Ashish for ur reply..
i tried with delete []pBuffer .. but doesn't workout for this ..!
as per my view the reason for my problem must be ..
it tries to delete the pointer which is Still in use because in the whole code when i delete the other poniters it is ok but as the last statement uses the pointer for writing the data and in the next statemnt it is tried to delete it ...!!
does it make sense ..?
|
|
|
|