|
yes it is..
i tried using
POINT pos;
GetCursorPos(&pos);
int x=pos.x;
int y=pos.y;
but when i compile it appear is error.
Compiling...
SetCursorPos.c
C:\Program Files\WiT8.1\customcp\cplib2\src\SetCursorPos.c(10) : error C2143: syntax error : missing ';' before 'type'
C:\Program Files\WiT8.1\customcp\cplib2\src\SetCursorPos.c(11) : error C2143: syntax error : missing ';' before 'type'
Error executing cl.exe.
SetCursorPos.obj - 2 error(s), 0 warning(s)
|
|
|
|
|
Looks like you're missing windows.h.
You may want to use the project wizard to build a Win32 project for you.
Then you'll have a good starting point with the basic required header files
included.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thx mark..
but i had a new error.
coding:
#include "wcplib2.h"
#include <windows.h>
#include <iostream>
using namespace std;
CorOpRtn myCo_SetCursorPos(CorObj *In, CorObj *Out)
{
POINT pos;
GetCursorPos(&pos);
int x=pos.x;
int y=pos.y;
return COR_OP_OK;
}
Error:
Compiling...
SetCursorPos.c
c:\program files\microsoft visual studio\vc98\include\eh.h(32) : fatal error C1189: #error : "eh.h is only for C++!"
Error executing cl.exe.
SetCursorPos.obj - 1 error(s), 0 warning(s)
Student86
|
|
|
|
|
The error message says it - you'll need to be compiling for C++
to use eh.h
Renaming the source file with a .cpp extension is probably enough.
If not, the /TP compiler option will do it. You can set this for
a project in the project properties/C/C++/Advanced section.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am creating a class for a dialog that can be used either in modal or modeless form, and I would like to use them both at the same time in a dialog-based app.
The complication is that the modal form and the modeless form use different resources (modal form has an 'OK' and 'Cancel' button, modeless does not) wondering if it's possible to use them in the same application since VS2005 puts the following line in CDialog-derived classes:
[code]
// Dialog Data
enum { IDD = IDD_DX9MATERIAL_DIALOG };
[/code]
which seems to tie the class to the dialog, no? Is it not possible to the use the same class for two dialogs? Or should I just create another version of the class for the two types of docs?
Thanks - @LRG
|
|
|
|
|
@largeinsd wrote: which seems to tie the class to the dialog, no?
Yes. It's only source code....feel free to alter it for your own use
The IDD is used only one place by default - it is passed to the CDialog
constructor. With a little modification you can pass whatever resource ID
you want to the base class.
Another alternative in this case, is to use one resource and show or hide the two
buttons depending on if the dialog is used modal or modeless.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Another alternative in this case, is to use one resource and show or hide the two
buttons depending on if the dialog is used modal or modeless.
Kaboom! That's why you're the MVP... and I'm just glad we're on the same team.
Thanks Mark, I will implement that.
|
|
|
|
|
@largeinsd wrote: I'm just glad we're on the same team.
What team?
Maxwell Chen
|
|
|
|
|
Team MFC/C++!
Of course
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Team MFC/C++!
I thought that you and largeinsd were co-woring on some specific project.
Maxwell Chen
|
|
|
|
|
Heh - nah....I took it more as an expression -
same thing as "I'm glad we aren't enemies" or "glad we're
not working against each other"
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanks
|
|
|
|
|
Just kidding
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
But why you dont want to use of wmi?
|
|
|
|
|
Hi,
There is a site with a page containing an HTML form for accessing private areas. This form requests an username and password to login.
I need to programmatically send username and password to the destination page of the form using POST method (to download an automatically generated file contained into the site reserved area).
This is not very hard to do I think, but my question is:
whenever login succeeded (the destination page of the form has accepted and verified username/password sent and probably that page redirects to another page, which should be the reserved area, on successfull login), is there a way to request a page from the reserved area ? The 'user' is still logged in for the server between a WinInet request and the next one ? (who manages the session and cookies to mantain the user logged?)
Thanks
|
|
|
|
|
I'm having a problem with date controls. Basically, I want the 2nd control(finalize date) to default to the date value in the first control(business date). And, the 2nd control should allow the date to be changed to a date that is within one day of the 1st control.
OnDatetimechangeDtcBusiness(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
COleDateTime dtMinRange;<br />
COleDateTime dtMaxRange;<br />
<br />
CString csBusDate;<br />
GetDlgItem(IDC_DTC_BUSINESS)->GetWindowText(csBusDate);<br />
<br />
COleDateTime dtBusDate;<br />
dtBusDate.ParseDateTime(csBusDate);<br />
<br />
dtMinRange.SetDate(dtBusDate.GetYear(), dtBusDate.GetMonth(), dtBusDate.GetDay() - 1);<br />
dtMaxRange.SetDate(dtBusDate.GetYear(), dtBusDate.GetMonth(), dtBusDate.GetDay() + 1);<br />
<br />
((CDateTimeCtrl*)GetDlgItem(IDC_DTC_FINALIZE_DATE))->SetRange(&dtMinRange, &dtMaxRange);<br />
m_dtFinalizeOnDate = dtBusDate;<br />
<br />
*pResult = 0;<br />
}
The 2nd date is not defaulting to the 1st date. The 2nd date is defaulting to one day after the 1st date.
Any and all comments are greatly appreciated. If you see something that could be done a better way, please let me know.
Thank you.
|
|
|
|
|
So what's the problem? Why are you using GetDlgItem() rather than an actual control variable?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry about that, I edited my message post. The problem is that the 2nd control date is defaulting to one day after the 1st control date(business date).
|
|
|
|
|
littleGreenDude wrote: The problem is that the 2nd control date is defaulting to one day after the 1st control date(business date).
Isn't that what you told it to do?
dtMaxRange.SetDate(dtBusDate.GetYear(), dtBusDate.GetMonth(), dtBusDate.GetDay() + 1);
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No. That sets the allowable range for the 2nd date control. The minimum can be one day before the date of the 1st date control, and the maximum can be up to one day after the date of the 1st control.
((CDateTimeCtrl*)GetDlgItem(IDC_DTC_FINALIZE_DATE))->SetRange(&dtMinRange, &dtMaxRange);
The user should be allowed to change the 2nd date to any value within the 3 day range. But, when they change the date in the 1st control, the range should reset and the new default date of the 2nd date control should be the value of the 1st date control.
|
|
|
|
|
littleGreenDude wrote: ...the new default date of the 2nd date control should be the value of the 1st date control.
So where/what is your code to do this?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Right after the range is set.
m_dtFinalizeOnDate = dtBusDate;
|
|
|
|
|
Ok, is m_dtFinalizeOnDate a CDateTimeCtrl or CTime object? If the former, shouldn't you be using the SetTime() method?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
m_dtFinalizeOnDate is a COleDateTime object that is set by a CDateTimeCtrl.
|
|
|
|
|
littleGreenDude wrote: ...is set by a CDateTimeCtrl.
I'm not exactly sure what you mean by this, but your code snippet worked fine for me by making one small change.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|