|
good afternoon, all
I am trying to get rid of one of the old link library from my application
I removed it from preprocessor definition, took all the link library files from LINK, but the program will still step into the area says #ifndef __XYZ_APP__ when I am doing debugging.....It really shouldn't behave like this, I also checked if anything like #define __XYZ_APP in header ....still no luck
does any body know why is this happening? thank you for your time
-- modified at 18:25 Wednesday 7th September, 2005
|
|
|
|
|
#ifndef __XYZ_APP__
this means: if __XYZ_APP__ is not defined, compile the code inside of me.
Since you undefined it, that is what should happen
|
|
|
|
|
a lot of confusion to me
ok. Preprocessor symbols can be defined in two ways. (As I know)
1. in the source or header files
2. In the project setting. Please check the project settings, preprossor options..
BAsically All debug relateted preprocessor are defined in project setting only..
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
i have been trying to use this in my DLL but an error occurs saying its an unreclared symbol
if i try to include afxwin.h during compile it says i can't include it
am i missing something?
thanks
Andy
|
|
|
|
|
Anonymous wrote:
i have been trying to use this in my DLL but an error occurs saying its an unreclared symbol
Is MFC in your DLL, if NO, then you two option either enable MFC in your DLL or call Win32 version of AfxBeginThread in your DLL like.. CreateThread .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Anonymous wrote:
i have been trying to use this in my DLL but an error occurs saying its an unreclared symbol
Haven't you also received this compiler message about AfxBeginThread() ? If not, why are you trying to end a thread that has not been started?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hi, i have a question about interfaces and templates: is it possible to have a function template inside a interface? see code:
__interface ITest {<br />
template<class T> void TestFunc(T& data, int size);<br />
}
is there an alternate method? i get a compiler error on this code. i am just getting started with templates
|
|
|
|
|
oops, sorry the formatter messed up my template<> brakets.
anyway i think i figured it out -- abstract classes are basically the same as interfaces, so use it:
template<class T> class ITest {
void TestFunc(T& data, int size);
// ...
};
|
|
|
|
|
Working on an interesting server application. On a private LAN this serever will handle about 120 clients(socket server) and at the same time it will communicate via 160 serial COM ports(COM server). For that we use multiple "PortServer" boxes by Digi which connect to LAN on server side and provide serial ports on the other. Digi's driver makes COM port control absolutely transparent. The idea is that the apps written for "classical" COM ports should work using "PortSErver" via LAN without a single code change.
Both socket and serial communication are implemented using IOCP. While socket server works fine the COM server starts eating up memory after some time. The nature of serial communication is a constant polling(and remote responses) @9600Bd on all 160 ports. Messages are only 6bytes long and all 160 COM ports hang on a single IOCP. This type of operation puts more strain on IOCP queueing mechanism than a typical LAN data stream. We are quite confident that the memory leak is not some silly thing in our code and here comes the question. Does anybody have experience with this type of IOCP application? I would really appreciate your comments.
Thanks,
Tom
|
|
|
|
|
I have a VC++6 application(.h, .cpp & lib). I also want to create a new VC++.NET application(Window Application Form: main code write in .h form) using this VC++6 application. Can I apply VC++6 into VC++.NET? If yes, how can I do this?
for example, how can i put a VC++6 CxImage class into my new VC++.NET? Please give me a hint or any reference. thanks all.
-- modified at 15:51 Wednesday 7th September, 2005
|
|
|
|
|
If you're moving source code, you'll have issues to do with the fact that VC6 is not very standards compliant. One of the most common issues is code like this
for (int i = 0; i < 10; ++i)
{
// do something
}
if (i<10) // won't work
{
}
for (i=0;i<10;++i) // won't work
In vc6, the variable i was visible outside the for loop, which is against the standard. Declaring i before the first loop fixes this.
If you're linking to a lib, you'll have problems because they will link to different versions of the C run time. I have a problem like that now, I've asked about it here and in the Microsoft forums about 6 times, and no-one seems able to help me solve it. However, the short answer is that you need to recompile the lib in VC.NET ( it just compiles in my case, then won't link ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How do I add color to, say, items in a list box? For a piece of my app I'm trying to recreate a list of files in a directory and I want to color the words according to certain parameters. Specifically, I want four colors: green, black, blue, and red.
Danny
|
|
|
|
|
|
I need a way to implement a scrollable list of modeless dialog box instances. I've worked a bit with CListCtrl extensions that allow in place text editing, combo boxes, check boxes, progress bars, and the like. But these extensions require the CListCtrl to be in report-view form with columns. A solution might be a CListCtrl extension that supports a non-column view like icons, only with dialog boxes instead of icons. This may be unthinkable, or may already exist, I don't know. Or maybe there's a simpler approach I haven't thought of.
Any ideas? I can email any responders a mock-up screen image -- that picture's worth a 1000 words at least.
Thanks.
|
|
|
|
|
What would you say of using those dialog boxes within a "Document-View" architecture.
It's like embedding some dialog boxes in a word document (which actually is doing more than scrolling information )
SkyWalker
|
|
|
|
|
A good thought, but this is a mature app and changing it to doc-view is not an option at this point. More than scrolling information, the dialogs have there own controls, so they are interactive. I may go to a paging scheme instead of scrolling. The downside to this is the need to support specific monitor resolutions -- running at 1280x1024 I can fit 6 per page, running at 1024x768 I may only fit 2.
|
|
|
|
|
Yes, probably attaching each of them to one tab of a multi-tab control will be the best solution.
SkyWalker
-- modified at 10:17 Thursday 8th September, 2005
|
|
|
|
|
I have alot of checkboxes on a screen. At the bottom of the
screen, I have two checkboxes, m_check20 and m_check21, and
only one of them can be checked. So I set up this code:
void CPage1::OnCheck20()
{
m_check20 = 1;
m_check21 = 0;
UpdateData(FALSE);
}
and I did almost the same for OnCheck21. The problem is, when
this code is run, the UpdateData(FALSE) commands resets all of
the checkboxes that were at the top of the screen (m_check1 ...
m_check19).
How can I update just m_check20 and m_check21 without updating
the rest of the check boxes on that page?
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
Don't use UpdateData() for that purpose.
Get a pointer to the desired check-box control:
CButton *pCB = (CButton *)GetDlgItem(your check box id here);
Then call pCB->SetCheck(nCheck)
where nCheck is 0 for unchecked state and 1 for checked state.
SkyWalker
|
|
|
|
|
One last question.
I put together this:
void SetCheckbox(int nID, bool state)
{
CButton *pCB = (CButton *)GetDlgItem(nID);
if (pCB)
pCB->SetCheck(state);
delete pCB;
}
and so I call:
SetCheckbox(IDC_CHECK20, 1);
SetCheckbox(IDC_CHECK21, 0);
But when I compile, I get this error:
error C2664: 'GetDlgItem' : cannot convert parameter 1 from 'int' to 'struct HWND__ *'
The function GetDlgItem takes 2-variables, int nID and HWND *phWnd. I tried using null for the 2nd variable (phWnd) but it
wont work. How can I clean this up to work?
Please, any response you can give me will be greatly appreciated.
I have alot of check boxes and need to condense.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
The GetDlgItem function retrieves the handle of a control in the specified dialog box.
HWND GetDlgItem(
HWND hDlg, // handle of dialog box
int nIDDlgItem // identifier of control
);
Notice the above text from MSDN.
DanYELL wrote:
I tried using null for the 2nd variable
Don't use NULL for the 2nd variable:
(1) Because the HWND structure was supposed to be the first variable, hence your original error:
DanYELL wrote:
error C2664: 'GetDlgItem' : cannot convert parameter 1 from 'int' to 'struct HWND__ *'
(2) Because the HWND parameter in GetDlgItem is supposed to be the handle of the dialog that this dialog item is on. Try possibly, this , the word "this" referring to "the current dialog".
The simpler, though perhaps more unpopular/messier way would be to use UpdateData(), but not UpdateData(FALSE). The check boxes usually function pretty cool by themselves (i.e. checking an unchecking themselves when you click on them), but you're trying to control a partner check box. So, try something like:
<br />
void OnCheck20(void){<br />
UpdateData(TRUE);
<br />
if(m_Check20 == true){<br />
m_Check21 = false;<br />
UpdateData(FALSE);<br />
}<br />
else if(m_Check20 == false){
}<br />
}<br />
Write a similar function for the other check box. You just gotta use the UpdateData(TRUE) so you don't change all the other controls to their last updated state.
Danny
|
|
|
|
|
I've just sent by e-mail a small test VC project
showing what you need )
SkyWalker
|
|
|
|
|
if only one check box is to be checked, use radio buttons instead.
however, you don't test if the checkbox is effectively checked or not - because the event handler is called wether you check or uncheck it.
void CPage1::OnCheck20() {
UpdateData()
if (m_check20 == TRUE) {
m_check21 = FALSE;
UpdateData(FALSE);
}
}
void CPage1::OnCheck21() {
UpdateData()
if (m_check21 == TRUE) {
m_check20 = FALSE;
UpdateData(FALSE);
}
}
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
DanYELL wrote:
The problem is, when
this code is run, the UpdateData(FALSE) commands resets all of
the checkboxes that were at the top of the screen (m_check1 ...
m_check19).
Which is one of the many reasons to not use the function. See here for more.
DanYELL wrote:
How can I update just m_check20 and m_check21 without updating
the rest of the check boxes on that page?
Have a CButton member variable for each checkbox. Use the SetCheck() and GetCheck() methods.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
You could also use the CheckDlgButton function.
<br />
CheckDlgButton(IDC_CHECK20, 1);<br />
CheckDlgButton(IDC_CHECK21, 0);<br />
He is smart. He will make our Windows go.
|
|
|
|