|
Thanks Peter, this one was a confusing type definition
|
|
|
|
|
Dear Friends,
My application is opening an instance of MS-Word using automation. My application is thus receiving all events sent by that instance of MS-Word.
Now I want to get key stroke events on that instance of MS word. i.e if user press Ctrl+A while typing in MS-Word, i want my application to get notified. How can i do so ??
I already obtained the 'handle' of that instance of MS-WORD which is opened by my application via automation. Please give me your suggestions.
Imtiaz
|
|
|
|
|
Hi,
I´m trying to make a 1d array of classes but havent really got it working that good.
This is what I´ve done:
Enemy **enemy;<br />
enemy = new Enemy*[2];<br />
enemy[0] = new Enemy(g_lpDDSBack, hInstance, g_pDD, 100, 0, 48, 48, NULL);<br />
enemy[1] = new Enemy(g_lpDDSBack, hInstance, g_pDD, 300, 0, 48, 48, NULL);<br />
<br />
ofstream fout;<br />
fout.open("output.txt");<br />
fout << enemy[0]->PrintDestX() << endl;<br />
fout << enemy[1]->PrintDestX() << endl;<br />
fout.close();
Obviously what I´m trying to do is to set enemy[0]´s DestX to 100 and enemy[1]´s DestX to 300.
The thing is, when I´m printing out both enemies DestX both says 300.
What am I doing wrong, or should do diffrent?
Thanks.
|
|
|
|
|
Can you post the implementation of the Enemy constructor?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Is this what u want?
Enemy.h
class Enemy: cSurface<br />
{<br />
public:<br />
Enemy(LPDIRECTDRAWSURFACE7 lpDest, HINSTANCE hInst, LPDIRECTDRAW7 hDD,<br />
int destX, int destY, int nWidth, int nHeight, <br />
COLORREF dwColorKey = -1);<br />
Enemy();<br />
~Enemy();<br />
int PrintDestX(){return DestX;}<br />
int PrintDestY(){return DestY;}<br />
...<br />
private:<br />
static int Width, Height, DestX, DestY;<br />
}<br />
Enemy.cpp
int Enemy::Width;<br />
int Enemy::Height;<br />
int Enemy::DestX;<br />
int Enemy::DestY;<br />
<br />
Enemy::Enemy(LPDIRECTDRAWSURFACE7 lpDest, HINSTANCE hInst, LPDIRECTDRAW7 hDD,<br />
int destX, int destY, int nWidth, int nHeight,<br />
COLORREF dwColorKey)<br />
{<br />
Alive = true;<br />
<br />
hInstance = hInst;<br />
surface = lpDest;<br />
lpDD = hDD;<br />
Width = nWidth;<br />
Height = nHeight;<br />
DestX = destX;<br />
DestY = destY;<br />
<br />
this->Create(hDD, nWidth, nHeight, RGB(255, 0, 255));<br />
this->LoadBitmap(hInst, IDB_ENEMY, 0, 0, 48, 48);<br />
}
|
|
|
|
|
Hello,
I see your problem. change:
static int Width, Height, DestX, DestY;
to:
int Width, Height, DestX, DestY;
Your problem lies in the static qualifier. If you make member variables of one class static, than the viariable is shared among all instances of that class. If you remove the static qualifier, than each class has it's own copy of the variable.
I also got the blogging virus..[^]
|
|
|
|
|
SuperTank wrote:
I´m trying to make a 1d array of classes...
This is what I´ve done:
Enemy **enemy;
This is not the correct way to implement a one-dimensional array. Technically, an array is one-dimensional by default. See here for an example of a 3D array.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Sir,
I am using VC++.
Suppose I have a html page on the Net server. The page has a table, in that table this value is stored like 100.200.300.400. So now I want to read it from the Net server & store it in the VC++ base application.
So please would you provide me some useful info.
Thanks in advance.
Regards,
Ramesh.
|
|
|
|
|
|
As Alok has pointed out, you can use Ander's AmHttpUtilities class. If you need to do more involved parsing of the HTML content, see this[^] article.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
Hello.
I have following problem. I add user credentials (on WinCE, but i think on Win32 it's similarly) using function CeCredWrite(...).
There are CECREDENTIAL struct as parameter of this function. And I fill all fields of this struct with one exception - I don't know how I can fill CredentialBlob field (this field is for password in my way) because there must password in "NTLM format" as written in MSDN, I think there is hash of plain password string, but how can get this hash?
What functions are for getting hash of password in NTLM format?
Thanks
Ernst Maurer
|
|
|
|
|
Hi,
I have a MFC app with no dialogs,document/view.I have derived my class from CWinApp.
My question is :
1.At one point My application has to wait for socket connections(act as server).how to write a code for this?.I'm using CAsyncSocket.
2.How to write a message loop/pumps for socket connections/messages?
Pls help .I'm struggling.
Thnaks
Ram
|
|
|
|
|
|
Hello,
Any hint on how to remove unused resource strings? One of my projects functionality has shrinked and now I got a lot of resource strings defined in the string tables but they are not used any more.
Do you have a tool/hint/macro/add-in that may help to detect and remove unused resource strings?
I also use this great tool: Resource ID Organizer Add-In for Visual C++ [^]
--- Ricky
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
In VC6, do View | Resource Symbols and delete the unused ones.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
True, This goes also for VC 7.* for unused Resource Symbols..
My question was not for Resource Symbols but Resource Strings.
Once you define a Resource String (Add an item on the String Table), it will appear as an used Resource Symbol even if you don't use the just defined Resource String on your code.
That is, I'm looking for a way to discover (and maybe delete) all the unused Resource Strings on the code.
Thanks in advance..
--- Ricky.
P.D. the underlined words above are for differentiating the words, not because I'm "shouting" or "angry".
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
Ah. Sorry, I was hasty in replying!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi
I have an application which opens a file multiple times. The series of operations are as follows:
1. Open File when an OPEN button is pressed.
2. Close file when a CLOSE button is pressed.
After the 2. operation is complete and 1. option is given the same file is opened again.
But at this point, the OPEN fails and the application freezes.
Sreekanth Muralidharan,
Corporate Systems Consultant [Embedded Systems],
INDIA
|
|
|
|
|
If you open file Exclusivly and Doesn't free the Memory associated with FILE handle at close. when you again try to open that file, this type proplem always persist.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Should closing the file do the job? Or else, is there any explicit API to free the memory associated with the file handle? Please help.
|
|
|
|
|
Should closing the file do the job? Or else, is there any explicit API to free the memory associated with the file handle? Please help.
Sreekanth Muralidharan,
Corporate Systems Consultant [Embedded Systems],
INDIA
|
|
|
|
|
Sreekanth Muralidharan wrote:
there any explicit API to free the memory associated with the file handle?
Hi Mr MuraliDharan,
Could you please tell Which api are you using to Open the File?.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hi Alok
I am not using any APIs for this. I am using the CFile class in MFC for managing the file operations. The file operations are simple read and write and the file has the contents downloaded via a USB interface.
The flow is somewhat like this:
1. When user presses PLAY button, a play thread is started.
2. The PLAY function opens the file and assigns the handle to a CFile object.
3. When he presses STOP the thread is terminated and the file is closed.
The play thread goes on like this:
1. Read a block of 64 bytes from the file.
2. Write the block to the USB handle.
NOTE: The file is made by a separate module in the same application. So the application which downloads the USB contents is independant of the module which reads from it.
Expecting your help again....
Sreekanth Muralidharan,
Corporate Systems Consultant [Embedded Systems],
INDIA
|
|
|
|
|
Sreekanth Muralidharan wrote:
When he presses STOP the thread is terminated and the file is closed
Hi SreeKanth,
Sorry for replying late,
Sreekanth Muralidharan wrote:
I am using the CFile class in MFC for managing the file
according to Oops Concept, the CFile will close the File and frees memory related to it in Destructor.
Sreekanth Muralidharan wrote:
assigns the handle to a CFile object.
Are you calling Corressponding CFile::Detach() as you must be calling CFile::Attach to attach File Handle.
Have you checked the thread Stop gracefully without any problem before second time play button hit!.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|