|
I have tried a program from this website windump
http://www.codeproject.com/cpp/windump.asp
and it will list all the current running windows. I need to get at the data within the window not just it's title.
For example if notepad was running how could I extract the characters in the notepad window?
|
|
|
|
|
Try
SendMessage with WM_GETTEXTLENGTH and WM_GETTEXT
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
hello there. i am assign into creating a standard configuration file and routines to implement this. what i did was create class associated with every application and the set the value in the file with the same format.
for example:
class app {
public:
int var1;
int var2;
app{
var1 = 0;
var2 = 1;
}
};
class CONFIG{
app a;
};
class CConfig{
CConfig(char * path);
public:
CONFIG config;
};
main()
{
CConfig * con;
con = new CConfig("configuration.cfg");
printf("%d",con->config.a.var1);
}
Configuration File;
[start]
config.a.var1 = 20;
config.a.var2 = 200;
[end]
my problem is how to associate every line of the configuration file to the elements of the class.
or my question would be how can i transform a string into a object. i already know how to convert object into string but i 'm still hesitant on looping every object and compare it to every line of the file.
|
|
|
|
|
I have a project in wich I use socket functions (AfxSocketInit is called at the very begining of the execution)... When the program calls getprotobyname, this function returns NULL (error code WSANO_DATA)...
Why this function fails?
More tips. The app works fine in other computer, so
Why this function fails in a computer and works in other?
Thanks
|
|
|
|
|
getprotobyname simply reads the protocol file - on Windows NT/2000/XP/2003 systems, this file lives in C:\Windows\System32\Drivers\etc . It's possible that the file has been corrupted, since the error code WSANO_DATA means that the name was found in the file, but some of the other data was missing.
I have to ask: why do you want to read from this file? It would only be useful if you were constructing raw IP packets. Perhaps you intended getservbyname instead?
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
thnk chris
I checked that before and the file is correct (even I copied that file from the computer that works fine to the one that doesn't).
The exact piece of code (a socket class wrapper) is:
struct protoent *ppe;
if(eType == eDGram)
ppe = getprotobyname("udp"); // 17
else
ppe = getprotobyname("tcp"); // 6
nProto = ppe->p_proto;
m_Socket = socket(PF_INET, eTipo, nProto);
I've got many apps working with this piece of code. If I replce that code with:
if(eType == eDGram)
nProto = IPPROTO_UDP;
else
nProto = IPPROTO_TCP;
m_Socket = socket(PF_INET, eTipo, nProto);
the class works.
The point is that I can't realize why the first code suddenly doesn't work
|
|
|
|
|
Juan Antonio Bermejo wrote:
thnk chris
oops... I mean 'Thnk mike'... your signature confused me...;P
|
|
|
|
|
As I said, probably an error in the protocol file.
These numbers really aren't going to change, because they're the protocol numbers defined originally by the IPv4 specification and now managed by IANA[^], the Internet Assigned Numbers Authority. These are the same for IPv6.
Just use the constants. It's easier and less prone to breaking.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi world...
What is the most useful way to change language in an application?
I've read we can do that with explicit link for DLL (one DLL for each languages ressource). Example:
- exported from french.dll file:
extern "C" __declspec(dllexport) char* get_text(int id_text);
- int the application:
typedef char* (MY_FUNCTION)(int);
HINSTANCE hInstance;
MY_FUNCTION *pFunction;
VERIFY(hInstance = ::Loadlibrary("c:\\winnt\\system32\\french.dll"));
VERIFY(pFunction = (MY_FUNCTION*) ::GetProcAddress(hInstance, "get_text"));
char* good_language = (pFunction*)(1054);
Is that a good solution?
Thanks for your suggestions...
Hello World!!!
from Raphaël
|
|
|
|
|
Maybe you have already found a solution. If not search MSDN for Resource-only DLLs and check for samples using the function AfxSetResourceHandle.
Hope it helps.
...Plug & Pray...
|
|
|
|
|
Thanks for your reply... I've already found this solution... But thank you nevertheless...
|
|
|
|
|
What kind of software can i use for developing a multilingual app in delphi?
I am thinking of using xml or dll. What are the differences pros and cons?
Can anyone please help me?
|
|
|
|
|
How can I tell which version of windows I am operating on? Is there an API call?
|
|
|
|
|
BOOL GetVersionEx(LPOSVERSIONINFO lpVersionInfo);
Declared in winbase.h, include windows.h to get it. MSDN has information on the OSVERSIONINFO struct (see below).
GetVersionEx[^]
Hope this helps.
--
Henrik Stuart (http://www.unprompted.com/hstuart/[^])
|
|
|
|
|
I am unable to synchronize the threads(simultaneous) greater when they are greater than 100. The thread increments a global Unsigned Long the requested num of times.
The code is....
// [5/4/2004] AS told by Marshall Brain.....
// thread 3
// very simple MULTI threaded prg...with CRITICAL SECTION synch'n method
// Prob ?? : Results are RANDOM ??
#include<windows.h>
#include<iostream.h>
volatile ULONG g_count = 0; // volatile so that compiler doesn't do any optimizations (like place it in a register)
// and we are able to alter the var. inside the thread also
const INT NoOfThreads = 10;
CRITICAL_SECTION CritSec;
void CountThread(INT Iterations)
{
INT i;
// UINT x;
Sleep(5000);
for( i=0; i
|
|
|
|
|
Not sure about this for loop?
for( i=0; i
{
// EnterCriticalSection (&CritSec);
// x = g_count;
//x++;
g_count++;
// LeaveCriticalSection (&CritSec);
}
But here, try this.
Static CRITICAL_SECTION CritSec;
For (i= 0; x < something; ++x)
{
x = g_count;
x++;
EnterCriticalSection (&CritSec);
g_count++; // This is global to all threads so lock this only.
LeaveCriticalSection (&CritSec);
}
So yes, you are right the answer would be random. If you don’t want random then do this.
Static CRITICAL_SECTION CritSec;
// This is global to all threads so lock the whole loop.
EnterCriticalSection (&CritSec);
For (i= 0; x < something; ++x)
{
x = g_count;
x++;
g_count++;
}
LeaveCriticalSection (&CritSec);
|
|
|
|
|
Hi all,
I want to embed/open a word file in my own ATL ActiveX control. is it possible? i don;t want to use MFC.
Can someone help me.
Thanks in Advance,
Abhishake
|
|
|
|
|
hi..
Iam developing an application which needs to create a horizontal bar,and according to the changes in the values of the variables it need to show the percentage of change using 3 colors.For eg i have 3 colors Red,Green and Blue...those colors should be displayed on the bar according to their percentage.How can i do it....
|
|
|
|
|
Hi there,
I was wondering if it is at all possible to change the tab order of controls (with WS_TABSTOP style) at run-time.
As far as I could find out up to now, only the order in which the controls are created define the tab-order, I got the problem now however that I derive a dialog from an existing one, the new one has a few extra controls which should appear between controls of the base-class dialog. The controls of the base class are created first and then the new controls which results in wrong tab-order in the dialog.
Any help would be greatly appreciated
Regards,
Davy
|
|
|
|
|
Try SetWindowPos() and change the Z-Order relative to another control.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
From MSDN:
To change the tab order at run time you would need to call the SetWindowPos API. Microsoft Windows maintains all the windows in the system in a list. It uses this list for purposes like painting the windows, maintaining the z order, and so on. The order in which the child controls (in a dialog) are created determines their position in the list and, hence, the tabbing order. By changing the position of the windows in this list, we can change the tabbing order. Change the window list order by calling SetWindowPos and passing the relevant windows handles in the first parameter (handle of the window to insert in order) and the second parameter (handle of the window to insert after). The window handle specified in the first parameter would come after the second in the tab order.
Maxwell Chen
|
|
|
|
|
Thanks,
Always thought that a lot of questions in this forum could be left out if the questioner just went to the trouble of searching in MSDN lib for 2 minutes. Seems I am guilty of the same crime.
Thanks anyway,
Regards,
Davy
|
|
|
|
|
Dear Mr Bhavani;
Thank you for the help that you have given me in accessing a public variable from anywhere within my application. The problem is that the code did not work at all. The compiler strongly complained when i added these code:
((CDatastructorView *) AfxGetMainWnd())->m_main.Navigate"file://c:/datastructor/lectures/recursion_implementation.htm",0,0,0,0);
CDatastructorView is my view class and m_main is a web-control which i want to use.
The compiler responded as :
:\datastructor\lefttooldlg.cpp(1296) : error C2065: 'CDatastructorView' : undeclared identifier
C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')'
C:\datastructor\lefttooldlg.cpp(1296) : error C2059: syntax error : ')'
Could you please help me out because i am still pretty at lost.
Krugger
|
|
|
|
|
datastruct wrote:
error C2065: 'CDatastructorView' : undeclared identifier
In what file did you define the user type CDatastructorView?? Just include that .h file in the lefttooldlg.cpp.
Maxwell Chen
|
|
|
|
|
at the top of lefttooldlg.cpp add
#include "..." //... = header file where CDatastructorView is defined
and your call should be:
((CDatastructorView *) AfxGetMainWnd())->m_main.Navigate("file://c:/datastructor/lectures/recursion_implementation.htm",0,0,0,0);
Regards
Davy
|
|
|
|