|
brilliant101 wrote:
It gives an error that SetDICreateDeviceInfoList() does not take 7 parameters....
Right, it only takes two, which is what you have. SetupDiGetClassDevsEx() does take seven parameters, however, which you also have. Please provide the error verbatim from the compiler.
Unless you are just looking for something extra to do, there is no reason to respond to all of your posts with the name of the header files that have been included. Using < and > correctly will suffice.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
How to get text on screen at current mouse position.
le van giang
|
|
|
|
|
I can see that you're cross posting, so what language are you interested in?
Furthermore, your question is a bit fluffy, I think you have to be a bit more specific.
As leppie says in the C# forum, it's not possible to just get the text at a certain point.
But you can get the text from the HWND at the current corsor position, look up these functions in the Win32 API: WindowFromPoint, SetWindowsHookEx, GetWindowText, ChildWindowFromPoint.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
do you want the text to appear within your application window or anywhere in screen(including the area out of your application window).
1) if you want the text to appear within your application window,
handle WM_LBUTTONDOWN OR onLButtonDown(in mfc), and within that get the device context of client(GetClientDC(this)) and display the text using TextOut or DrawText.(use point for mouse location)
2) if you want the text to appear anywhere in screen,
-Capture the mouse using SetCapture.
-Get the screen device context, using CreateDC(NULL).
-display the text using TextOut or DrawText.(use point for mouse location)
|
|
|
|
|
The word "get" is ambiguous here. Do you want to read text from the screen, or write text to the screen?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I want to read text from anywhere on screen.
|
|
|
|
|
That will require use of the IAccessible interface, specifically the get_accValue() method.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello,
Could anyone tell me how to cope with this error message.
the start of my code goes like
#pragma once<br />
<br />
using namespace std;
...
I get the errormessage that the namespace does not exist, and msdn provide little information about this error message.
error C2871: ´std´:a namespace with this name does not exist
Sorry if I provide to little code or further descriptions...
But maybe somebody has a tips
best regards
doneirik
|
|
|
|
|
That should compile OK on any machine. Exactly on what line did you get the error message? Maybe where the error is generated your code is at a different scope not within that of your "using" declaration? Maybe where the error is generated the header file with your "using" declaration is not included?
|
|
|
|
|
this can come from the files you really include.
for example :
#include <string.h> this will include all the C standard function to manipulate C-string (strcat(), strlen(), etc...) in the global namespace : ::strcat(), ::strlen(),...
#include <CSTRING> this will put the functions in the std namespace : std::strcat(), std::strlen(), ...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
doneirik wrote:
Could anyone tell me how to cope with this error message.
the start of my code goes like
#pragma once
using namespace std;
...
I get the errormessage that the namespace does not exist, and msdn provide little information about this error message.
error C2871: ´std´:a namespace with this name does not exist
You probably should include a file with code in namespace std before 'using' namespace std, e.g.
#include <vector>
using namespace std;
|
|
|
|
|
hai ..
can anybody help me in my problem?My problem is to maintain constant size to one text file.eg 500kb then if i add any thing it will not show that text files size increasing.please help me.
regards
shaanu
shan
|
|
|
|
|
How about (temporarily) using a copy of the text file instead and add to that?
|
|
|
|
|
I am storing 32 bit keys.so i want to store some more keys.but the size of text file should be constat.i want to limit its size by some 500 kb like that.so what should i do for make constant size of text file in vc++?
shan
|
|
|
|
|
what about overwriting the file content ???
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
If you add to a file, it's going to increase in size. There is no way around this. This is a very odd requirement.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hi all,
I want to draw 3D object like a ball using GDI+ Graphics,Brushes..Can any body Guide me to do it?
Thanks in advance..
|
|
|
|
|
dear sir.
i am an MSc studient, I need some informations about my project which its titled "image compression using multiwavelet transform" (source code program to do it)in visual C++
with my regards
|
|
|
|
|
Do you know of any such api or function which enlists applications?
eg, Internet explorer,Word,Power point etc.
Also do you know of any api which enlists the the hardware devices like
mouse,keyboard,NIC etc
Please tell about these apis and their header files
Thanks a lot
|
|
|
|
|
brilliant101 wrote:
Do you know of any such api or function which enlists applications?
eg, Internet explorer,Word,Power point etc.
To get a list of running processes, use Process32First() and Process32Next() .
brilliant101 wrote:
Also do you know of any api which enlists the the hardware devices like
mouse,keyboard,NIC etc
Please tell about these apis and their header files
This is exactly what SetupDiEnumDeviceInfo() and SetupDiEnumDeviceInterfaces() are for.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
I develop a multi langugage support GUI screen in SDK, The appropriate language font doesn't displayed in dialog control, i done the settings in windows XP. But it doesn't displayed.
plz write your suggestion.
Regards,
Inbha.
|
|
|
|
|
Hi,
I'm trying to construct a library which features a class that should be able take a pointer to any user-defined function (preferably in a user-friendly way). Now, I've tried a templated approach which seems to work, but inheriting from template classes seems rather a pain and dito for all the different function pointer types. Small example:
<br />
#pragma once<br />
<br />
template < typename _TReturn, typename _TArg><br />
class IExecute<br />
{<br />
public:<br />
typedef typename _TReturn _return_type;
typedef typename _TArg _arg_type;
typedef void _class_type;
<br />
virtual ~IExecute(void) = 0;<br />
<br />
virtual _TReturn Execute(_TArg _Arg) = 0;
};<br />
<br />
template < typename _TReturn, typename _TArg><br />
inline IExecute< _TReturn, _TArg >::~IExecute(void)<br />
{ }<br />
<br />
template < typename _TClass, typename _TReturn = unsigned int, typename _TArg = void * ><br />
class CExecuteMember : public IExecute < _TReturn, _TArg ><br />
{<br />
protected:<br />
typedef _return_type (_TClass::*_ptr_type)(_arg_type);
typedef typename _TClass _class_type;
<br />
_class_type * m_lpClass;
_ptr_type m_lpRoutine;
<br />
public:<br />
CExecuteMember(void) : m_lpClass(NULL), m_lpRoutine(NULL)<br />
{ }<br />
CExecuteMember(_class_type * _Class, _ptr_type _Routine) : m_lpClass(_Class), m_lpRoutine(_Routine)<br />
{ }<br />
~CExecuteMember(void)<br />
{ }<br />
<br />
_return_type Execute(_arg_type _Arg)
{<br />
if (this->m_lpRoutine == NULL)<br />
throw std::runtime_error("No routine pointer exists");<br />
if (this->m_lpClass == NULL)<br />
throw std::runtime_error("No class pointer exists");<br />
return (m_lpClass->*m_lpRoutine)(_Arg);<br />
}<br />
<br />
inline _ptr_type GetRoutinePtr(void) const { return this->m_lpRoutine; }<br />
inline _class_type * GetClassPtr(void) const { return this->m_lpClass; }<br />
inline void SetRoutinePtr(_ptr_type _Routine) { this->m_lpRoutine = _Routine; }<br />
inline void SetClassPtr(_class_type * _Class) { this->m_lpClass = _Class; }<br />
};<br />
<br />
template < typename _TReturn = unsigned int, typename _TArg = void * ><br />
class CExecuteNonMember : public IExecute < _TReturn, _TArg ><br />
{<br />
protected:<br />
typedef _return_type (* _ptr_type)(_arg_type);
<br />
_ptr_type m_lpRoutine;
<br />
public:<br />
CExecuteNonMember(void) : m_lpRoutine(NULL)<br />
{ }<br />
CExecuteNonMember(_ptr_type _Routine) : m_lpRoutine(_Routine)<br />
{ }<br />
~CExecuteNonMember(void)<br />
{ }<br />
<br />
_return_type Execute(_arg_type _Arg)
{<br />
if (this->m_lpRoutine == NULL)<br />
throw std::runtime_error("No routine pointer exists");<br />
return this->m_lpRoutine(_Arg);<br />
}<br />
<br />
inline _ptr_type GetRoutinePtr(void) const { return this->m_lpRoutine; }<br />
inline void SetRoutinePtr(_ptr_type _Routine) { this->m_lpRoutine = _Routine; }<br />
};<br />
And then I tried an approach with functionoids (here[^]" rel="nofollow">) but that would require users to pretty much always encapsulate the target functions in a class derived from a functionoid interface. Small example:
<br />
#pragma once<br />
<br />
class IFunctionoid
{<br />
public:<br />
virtual ~IFunctionoid(void) = 0;<br />
virtual unsigned int operator()(void * lpArg) = 0;
};<br />
<br />
inline IFunctionoid::~IFunctionoid(void) { }<br />
<br />
typedef IFunctionoid * LPFUNCTIONOID;<br />
<br />
Anyone have any alternative solutions or improvements on the above? Please?
|
|
|
|
|
Anyone could please tell me,
How to convert from DIB to BITMAP?
How to convert from BITMAP to JPEG?
How to convert from DIB to JPEG?
|
|
|
|
|
|
HI,
In my project, I need to logon programmatically on the local machine.
I am using "LogonUser()" api. The calling process must have SE_TCB_NAME privilege enabled. I dont how to get that privilege.
For that I have written following code.
//Start
if(!OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hCurrentToken))
printf("\n\nError Code for OpenProcessToken : %u",GetLastError());
else
printf("\nToken obtained");
if(LookupPrivilegeValue(NULL, SE_TCB_NAME,
&tkp1.Privileges[0].Luid))
printf("\nLookup Privilege value TCB returned true");
if(LookupPrivilegeValue(NULL, SE_CHANGE_NOTIFY_NAME,
&tkp2.Privileges[0].Luid))
printf("\nLookup Privilege value CHANGE returned true"); ;
tkp1.PrivilegeCount = 1;
tkp2.PrivilegeCount = 1;
tkp1.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
tkp2.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if(!AdjustTokenPrivileges(hCurrentToken, FALSE, &tkp1, 0,
(PTOKEN_PRIVILEGES)NULL, 0))
printf("\nCan't set privileges required in tkp1");
dwErr = GetLastError();
if((dwErr != ERROR_SUCCESS))
printf("Error code for tkp1 : %u",dwErr);
if(!AdjustTokenPrivileges(hCurrentToken, FALSE, &tkp2, 0,
(PTOKEN_PRIVILEGES)NULL, 0))
printf("\nCan't set privileges required in tkp2");
dwErr = GetLastError();
if(dwErr != ERROR_SUCCESS)
printf("\nCan't set privileges required in tkp2");
strcpy(pchUserName,"user1");
strcpy(pchPasswd,"user1");
strcpy(pchDomain,"MYDOMAIN");
if(!LogonUser(pchUserName,pchDomain,pchPasswd,LOGON32_LOGON_INTERACTIVE
,LOGON32_PROVIDER_DEFAULT,&hToken))
printf("\nLogon failed :\n\n ");
//End
Output :
Token obtained
Lookup Privilege value TCB returned true
Lookup Privilege value CHANGE returned true
Error code for tkp1 : 1300
Logon failed :
**************************************************
Please help. How to set SE_TCB_NAME privilege and how to programmatically login on to the local computer.
bhavesh
|
|
|
|
|