|
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++
|
|
|
|
|
About the original topic again...
if i use showwindow(),how can i hide them later?
and for Edit control, which method should be used to hide them~
|
|
|
|
|
I have found the method already...thanks~
|
|
|
|
|
Sorry, I was in a meeting
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
If you know how many radio buttons will be needed, why not put them on the form, and show/hide them with ShowWindow ?
I agree. One of my applications does this, and trying to create/manage the controls at runtime would be a nightmare.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
how can I remove a button's edge...my button is flat and I want to remove the white edges around it.
|
|
|
|
|
You'll need to subclass CButton and handle its drawing.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I'm tryingt to automate some things and I want control of another program from within my program. For example, I want my C++ program to be able to open Microsoft Excel and print some data into a cell. Or I want my program to open a database application we use and export a query into a text file. Does anyone know how to gain this kind of control of another application from within my C++ program?
Yesterday is history
Tomorrow's a mystery
Today is a gift
That's why they call it the present
Danny
|
|
|
|
|
bugDanny wrote:
I want my C++ program to be able to open Microsoft Excel and print some data into a cell.
You can do this easily with Excel Automation. See MSDN article Q178749 for an example.
bugDanny wrote:
Or I want my program to open a database application we use and export a query into a text file.
I would use ODBC (or ADO) for this. Check out these two MFC classes: CDatabase and CRecordset .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|