|
VC6 is a decent C++ compiler, I doubt at your level that you'd find any places where it deviates from the standard.
Cillieacc0rd5o4 wrote:
This fool keeps one wanting to add stuff to the program.
Is 'this fool' a lecturer ?
Cillieacc0rd5o4 wrote:
And i only have limited Very limited C++ Knowledge.
I suggest buying a book that starts low and moves slow, like 'teach yourself C++ in 24 hours', and working through it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Nah that fool is from Testing Dept. Where i work at. I work in EDV Taking care of Networks of the company. I accationally write Java Code. Got temporarly assigned with this Fool to write a Programm For a Test Machine Robot. And it needs to be C++ a Language that i am learning as i write the project. So far i got 8 pages of codes in 1 week and 3 days. And this forum has helped me great deal on how the basic of C++ work =).
Worse thing that guy dont know how to program at all.
But yeah thanks guys!!!
PS: Got 2 C++ Books Here only one is usefull. the way teh other is written i dotn get it.
|
|
|
|
|
K all fixed but this if you can help.
term does not evaluate to a function
Error executing cl.exe.
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch(ul_reason_for_call)
{
{
case DLL_PROCESS_ATTACH:
int ScoMSGetAS();
unsigned short error;
unsigned short state;
double value;
>>>>>> error = SCO_AS6();
if (error != SCO_ERR_OPEN_DRIVER)
{
return ScoOpen();
}
else return FALSE;
}
break;
only prob left dun understand that though
|
|
|
|
|
Cilllieaac0rd wrote:
int ScoMSGetAS();
What is this meant to be ? It looks like a forward declaration of a function, which means it's in the wrong place. If ScoOpen returns an int then you need
int myInt = ScoMSGetAS();
if ScoMSGetAS is the name of an int you want to declare, then you need
int ScoMSGetAS;
I have to say, most of this stuff, the syntax is the same as Java.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I was trying to use somethign like this.
BTW i Couldnt log on before but its me again.
I am trying to use else if when the AS_SCO6 is executed it will give 0-5 digit depending on what error.
and it wanna do if or else for each 0 1 2 3 4 5 or just if 3 else rest.
Dunno the code for it though. cant find any info on t since i dunno what it is called.
{
case variable equals this:
do this;
break;
case variable equals this:
do this;
break;
case variable equals this:
do this;
break;
...
default:
do this
}
|
|
|
|
|
you've lost me entirely here. You seem to have provided a switch statement in what looks like VB, but what are you trying to do here ? If your compiler gave you some errors, then your code is wrong. You didn't say that, you said you didn't understand why there was an if/else inside a switch. Make sure your } do line up and the original code should work fine. Otherwise, if you want something else, explain it. These are all your own functions ? AS_SC06 is yours and you want to act depending on what the return value is ? Then you probably need another switch statement based on the return value. Your brackets will still need to line up in order for it to compile.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Been trying to allign em the entire morning.
Either the cofee is getting to me or this morning shift is making me see things.
On top is the entire switch.
I tryed to include a IF else inside the SWitch.
So depending on the value i get back it suppose to load teh driver or not.
aka if the value comes back to be no driver present it suppose to go ahead and load it. else just leave it alone.
YOu guys helped me before with the Switch stament that works fine now. Thnks alot =)
But i try to put thsi fail save in to block it from loading a driver that is already present. and only load it if its not.
|
|
|
|
|
This works with out the else if inside the switch. with the switch i can figure out how it works.
//
#define STRICT // wg. type checking
#include "windows.h" // wg. MessageBox
#include "stdlib.h" // wg. abs()
#include "usedll.h"
#include "scooter.h"
// damit die Funktionsnamen leserlich exportiert werden
#pragma comment(linker, "/DEF:usedll.def")
void exitfkt(void)
{
MessageBox(NULL,"Unload Dll", "Test", MB_ICONINFORMATION | MB_OK);
}
// Loading of the driver at start of the driver
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch(ul_reason_for_call)
{
{
case DLL_PROCESS_ATTACH:
int SCO_AS6();
unsigned short error;
unsigned short state;
double value;
error = SCO_AS6();
if (error != SCO_ERR_OPEN_DRIVER)
{
return ScoOpen();
}
else return FALSE;
}
break;
case DLL_PROCESS_DETACH:
atexit(exitfkt);
break;
}
return TRUE;
}
// return not loading driver();
EXP_USHORT TestDriver(void)
{
return SCO_AS6();
}
// Loading of the Driver
EXP_USHORT ItaOpen(void)
{
return ScoOpen();
}
// Unloading of the Driver
EXP_VOID ItaClose(void)
{
ScoClose();
}
// Power on/off for the Vacuum
EXP_USHORT Adaptor(int Status)
{
if(Status == 0)
{
return ScoMSSetVC(SCO_VC1,0);
}
else
{
return ScoMSSetVC(SCO_VC1,1);
}
}
// Power on off for VC2
EXP_USHORT VC2(int Status)
{
if(Status == 0)
{
return ScoMSSetVC(SCO_VC2,0);
}
else
{
return ScoMSSetVC(SCO_VC2,1);
}
}
// Reset all relays back use(CLRREL) command
EXP_USHORT Reset_All(void)
{
return ScoResetAllRelays();
}
// Set relays of the Unicard while set relays stay set
EXP_USHORT Set_Relais(int fl_set)
{
if(fl_set == 0)
{
return ScoUniSetRelay(fl_set,1);
}
else
{
return ScoUniSetRelay(fl_set,1);
}
}
// Reset relays of the Unicard while set relays stay set
EXP_USHORT Reset_Relais(int fl_set)
{
if(fl_set == 0)
{
return ScoUniSetRelay(fl_set,0);
}
else
{
return ScoUniSetRelay(fl_set,0);
}
}
EXP_USHORT Reset_All_Relais(int fl_set)
{
if(fl_set == 0)
{
return ScoUniSetRelay(fl_set,0);
}
else
{
return ScoUniSetRelay(fl_set,0);
}
}
EXP_USHORT VCC(int Number)
{
if(Number == 3)
{
return ScoMSSetVC(SCO_VC3,1);
}
else
{
return ScoMSSetVC(SCO_VC3,0);
}
if (Number == 4)
{
return ScoMSSetVC(SCO_VC4,1);
}
else
{
return ScoMSSetVC(SCO_VC4,0);
}
}
|
|
|
|
|
Cillieacc0rd5o4 wrote:
Been trying to allign em the entire morning.
Use Ctrl+} to match up braces, brackets, and parenthesis.
Cillieacc0rd5o4 wrote:
I tryed to include a IF else inside the SWitch.
What is so difficult about this:
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
if (some_condition)
mow_lawn();
else if (some_other_condition)
wash_car();
break;
case DLL_PROCESS_DETACH:
break;
default:
break;
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
It looks like you have a function (SCO_AS6 ) within a function (DllMain ). That's illegal.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I don't know what all the hu-bub is about, of course you can use an if-else statement with in a swich (your code should be working). Unless there is more to your code under DLL_PROCESS_ATTACH that you are not showing us, then you don't need all those extra variables and the if-else can be eliminated, as follows:
BOOL APIENTRY DllMain(
HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
return(SCO_AS6() != SCO_ERR_OPEN_DRIVER);
}
return TRUE;
}
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Problem : I have a dialog wherein i have a "Main" property sheet and one of the property pages of this sheet have a Tree control and an embedded "SubSheet" property sheet. I wanted to transfer data from one of the embedded "SubSheet" property pages to the tree Control which is in the Outer "Main" property page. Could u help me out in anyways. Is there any way of doing it. I am posting code which is the code in the main property page.
class CSanSettings : public CPropertyPage
{
DECLARE_DYNAMIC(CSanSettings)
public:
CSanSettings();
virtual ~CSanSettings();
// Dialog Data
enum { IDD = IDD_SANSETTINGS };
protected:
CPropertySheet m_SubSheet;
CSanDetails m_SanDetPage;
CAddSwitch m_AddSwtPage;
CScanSubnet m_ScanSubnetPage;
CFabricDetails m_FabricDetPage;
CSwitchDetails m_SwtDetPage;
CTestConnect m_TestConPage;
virtual BOOL OnInitDialog();
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
CTreeCtrl m_San_Display;
afx_msg LRESULT OnMyCode(WPARAM t1,LPARAM t2);
};
BOOL CSanSettings::OnInitDialog()
{
CDialog::OnInitDialog();
m_SubSheet.AddPage(&m_SanDetPage);
m_SubSheet.AddPage(&m_AddSwtPage);
m_SubSheet.AddPage(&m_ScanSubnetPage);
m_SubSheet.AddPage(&m_FabricDetPage);
m_SubSheet.AddPage(&m_SwtDetPage);
m_SubSheet.AddPage(&m_TestConPage);
m_SubSheet.Create(this, WS_CHILD | WS_VISIBLE, 0);
m_SubSheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT);
m_SubSheet.ModifyStyle( 0, WS_TABSTOP );
CRect rcSheet;
GetDlgItem( IDC_SHEET2 )->GetWindowRect( &rcSheet );
ScreenToClient( &rcSheet );
m_SubSheet.SetWindowPos( NULL, 20, 160, 0, 0,
SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE );
// return TRUE;
// return TRUE unless you set the focus to a control
}
Hemanth
|
|
|
|
|
In my opinion, you should share a pointer on your TreeControl in both property sheets. The pointer can be accessed from every property page using a GetParent() function.
~RaGE();
|
|
|
|
|
Hello folks,
I need some help with my C++ program, hope you can offer it to me.
I used fout<<time(0); to write the actual time to a file.
Now I need to transform the string which I retrieve from the file, back to time_t type, to be able to use the difftime function to calculate the time difference between time1 and time2 in seconds.
The problem is, that I am not able to test the time function at the moment, so it might also be possible to use difftime without transformation. I hope you can tell me, if this is so.
Hopefully I managed to describe my problem in an understandable way, as I am no native english speaker.
Best Regards, Jun_Misugi
|
|
|
|
|
Jun_Misugi wrote:
Now I need to transform the string which I retrieve from the file,
It is not written as a string so why retrieve it as such? Retrieve the value just like it was written, as a time_t type? Then you can easily subtract the two to find the difference.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Ok. Then I got the reference wrong. Thanks for your help.
|
|
|
|
|
Jun_Misugi wrote:
Then I got the reference wrong.
What reference?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Can anybody tell me how to place an icon in status bar and replace it with a new one at runtime?
|
|
|
|
|
|
Hi Masters,
I am trying to specify the output tray (output bin) for specific printer. It is quite easy to specify the input tray but I couldn't find the way to specify the output tray.
I have already look at the documentation of the printer. It says nothing about choosing the output tray programmatically. I know that I can choose the printer output tray via PCL. However, in my case, I need to use Win32 API since not all printer support PCL.
Thank you for any helps in advance
Cheers...
|
|
|
|
|
I have a program that is CAtlExeModuleT - derived. It is a dialog app, that is, it creates a dialog from CAtlExeModuleT<cmymodule>::Run() that does everything.
When I Alt+Tab through the task list, my app has a null icon (I have set the icon for the dialog). I would like to set that icon.
My first attempt was to use EnumWindows() and SetClassLongPtr() in the startup code, but that failed because my app does not have a window, only a dialog.
How can I set that icon?
Thanks very much.
N-o-R
riley dot dewiley at gmail dot com
|
|
|
|
|
This should be a general question like " how to create dialog item dynamically?" but since i am currently working with radio buttons, i choose to make specific.
The context that i am in is that i have defined a combo box with different types of information, and the combo box selection is dynamically calculated. For example, if "name" is selected, i need to draw an edit control beside the combo box.while if "sick?" is selected, two radio buttons are required to answer yes or no.
I hope i have explained it clearly. Can anybody help me to solve this problem?
Any help will be greatly appreciated.
|
|
|
|
|
If you know how many radio buttons will be needed, why not put them on the form, and show/hide them with ShowWindow ? Otherwise, you can create a new RadioButton using it's constructor.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks...
I have considered the idea of hiding, but it may not be suitable for this problem since the combo box will have a lot of types that require large number of radio buttons or check boxes.
Anyway, i will try the hiding method first. Thanks again~
By the way, do you know how to set cursor position in an Edit control? I tried using setsel() function, but nothing appears...
|
|
|
|
|
You need to have the number of characters before you can set the position ( i.e. if the edit box is empty, then the cursor has nowhere to go ). I'm pretty sure that setsel is the way to go.
Christian Graus - Microsoft MVP - C++
|
|
|
|