|
Hello, everyone!
Atfer opened several MS-Word applications, I want to get all the process IDs of them. The MS-Word applications are not invokeded by my VC application but invoked by some other applications on the same machine.
Can anyone show me a simple example on how to do it?
Thanks in advance,
Geo
|
|
|
|
|
I m feeling a bit stupid cause I ve got some trouble trying to make an item disabled in my menubar. I ve created my menu bar and now I m trying to attached it to a Cmenu object.And after I use a member function to change properties in this menu bar. I don t know whether this is the good method and moreover it seems that it doesn t work.
I m sure I just need one or two lines to do this.
Thanks
sysy
|
|
|
|
|
Have you switched off automatic menu updating?
Normally MFC apps use the CCmdUI related stuff to do menu updating during idle time or when a menu is to be shown.
It might be that the default handling of this is undoing any changes you make.
Steve S
|
|
|
|
|
I have a Dialog app and in the dialog class , I create a CpropertySheet object using the Create function. I want to make the propertySheet unmovable. But at the same time I need it to be enabled ? what should i do ?
Engineering is the effort !
|
|
|
|
|
Hi,
Is it possible to do serialization in an MFC application(i'm doing a game),without needing to use the Document/View architecture?
The reason i ask is,the only way i could get my MFC game to use a fullscreen window(DX9)without any flickering,was to build it from an old DirectDraw example i found(from this site i think).
The problem is,that this example doesn't use the Doc/View architecture,and all of the D3D setup is done in CMainFrame.
I've been trying for a few days now,to get it working in a AppName::View,but i'm having difficulties in doing it.
Is this possible? and could anyone point me in the direction of an example or tutorial please.
Thanks
Paul.
|
|
|
|
|
Just construct a CArchive on top of a CFile.
|
|
|
|
|
Thanks for that. It works! <grin>
|
|
|
|
|
paul8262 wrote:
Is it possible to do serialization in an MFC application ... without needing to use the Document/View architecture?
Absolutely. See this article.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks Ravi,appreciate the help.
I'll be studying this article tonight.
Can i ask you,if doing it this way will work just as well as if i was using Doc/View or have any limitations?
I started developing a game editor some months ago,using MFC with the doc/view and i could save all data that i created in it. e.g,camera positions,lights,geomitry etc.I could then load everything back into the editor perfectly.
Iv'e never developed a game using MFC(just used straight win32)and need it to provide the functionality that the editor has,for loading/saving games throughout the game.
What would have been ideal,would have been to get my fullscreen/dx9/mfc application to work in a SDI application with Doc/View support.
Although,i managed to get D3D all working properly in windowed mode,i couldn't stop flickering when in full-screen mode.
I found a small 'fullscreen' example that used Direct Draw,though can not work out how to add Doc/View support to it,as the set up is completely different.
Thanks again for your help.
|
|
|
|
|
I posted this earlier, but I guess I shouldve created a new message rather than replying to my previous one. It got buried in a few pages of messages.
I have classes car, street, building and static world. Here is my post (after posting a question about how to create global class objects):
I declared a global static class world, and it was indeed available to all objects. Thank you for the advice. Eventually I'll do the singleton method. The only problem now is, for some reason, objects are incapable of modifying public attributes or calling public methods of the global class.
Lets go back to my example. Before I had the global class, when constructing a "building" object, I had to pass it the myworld object constructor. The constructor would initialize certain variables, and call some initializing member functions. It would also call a member function of the myworld object, that would essentially(on the myworld object side) just increment the building count attribute of the world class. Before and after building object construction, I cout'ed myworld object's building count. It didnt change.
Now, with the static global object myworld, the results are the same. Myworld just refuses to change. Building has been made a friend class to the world class. In fact, nothing is private in the world class.
Just to check my coding, I called world class member functions and modified building counts directly from the main function, and it worked. It just doesnt seem to want to be modified by another object.
Any ideas?
|
|
|
|
|
|
Maybe this question sounds a little stupid. But I really had some trouble getting the text string I typed in the edit box. It is just 1 line string. I used this function:
iLength = SendMessage(hwndEditBox, EM_GETLINE, 0, (LPARAM) szBuffer);
I supposed that it should be working. But I used the debugger to check the string. There is nothing in szBuffer. I used this function
iCount = SendMessage(hwndEditBox, EM_LINELENGTH, 0, 0);
the return value is right.
So, how can I get the text string out of the edit box?
Thanks! I am waiting online.
|
|
|
|
|
U ve got two options.Either u can associate ur edit box with a CString (via classwizard when u create ur ressource for example).Normally u type ur string and when u close the dialog box ur sring is stored in ur CString.OR the other solution is 2 associate ur edit box with a Cedit object and to use the member function "GetWindowText()".I don t know if what I m saying is of any help 4 u, but good luck anyway
sysy
|
|
|
|
|
I have this code here out of a text book that is for a hash table. I understand the concept of a hash table but this code, for me, is somewhat difficult to understand. I am having problems figuring out how to implement the template class in the main.cpp file. I know some of the other code is not complete, but I would at least like to know how to implement the insert function from main.
And what exactly does std::size_t do?
P.S. I'm about ready to start from scratch and code my own.
Can somebody give me a jump start at this.
Thanks.
#include <iostream>
#include <string>
#include <cstdlib>
#include "table1.h"
using namespace std;
void main()
{
table<tractor> t;
t.hash(100);
}
TABLE1_H
#ifndef TABLE1_H
#define TABLE1_1
#include <cstdlib>
#include <cassert>
const size_t CAPACITY = 811;
int NEVER_USED = -1;
int PREVIOUSLY_USED = -2;
struct tractor
{
int key;
};
template<class recordType>
class table
{
private:
recordType data[CAPACITY];
size_t used;
template<class recordType>
size_t hash(int key) const
{
return (key % CAPACITY);
}
size_t next_index(size_t index) const
{
if((index+1)==CAPACITY)
return ((index + 1) % CAPACITY);
}
void find_index(int key, bool &found, size_t &index) const
{
size_t count;
count = 0;
i=hash(key);
while((count<CAPACITY) && (!never_used(i)) && (data[i].key != key))
{
++count;
i = next_index(i);
}
found = (data[i].key == key);
}
bool never_used(size_t index) const;
bool is_vacant(size_t index) const;
public:
table()
{
size_t i;
used = 0;
for(i=0; i<CAPACITY; ++i)
data[i].key = NEVER_USED;
}
template<class recordType>
void insert(const recordType &entry)
{
bool already_present;
size_t index;
assert(entry.key >= 0);
find_index(entry.key, already_present, index);
if(!already_present)
{
assert(size() < CAPACITY);
index = hash(entry.key);
while(!is_vacant(index))
index = next_index(index);
++used;
}
data[index] = entry;
}
template<class recordType>
void remove(int key)
{
bool found;
std::size_t index;
assert(key >= 0);
find_index(key,found,index);
if(found)
{
data[index].key = PREVIOUSLY_USED;
--used;
}
}
bool is_present(int key) const;
void find(int key, bool &found, recordType &result) const;
size_t size() const
{
return used;
}
};
#endif
|
|
|
|
|
Hi, in my app i need pop-up menu which items depends on a situation. How should i insert new items to this menu and how should i handle it if i have no constants defined in resource.h
Thank you.
|
|
|
|
|
Using:
AppendMenu(HMENU hMenu,UINT uFlags,UINT_PTRuIDNewItem,LPCTSTR lpNewItem);
|
|
|
|
|
Has anyone every done anything with Active Directory Notification. I need to write a service that listens to LDAP and lets me know when things change such password changes, etc. I found the sample code on MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/ad/example_code_for_receiving_change_notifications.asp), however I'm unable to get the code to compile. I seem to be missing all of the header files.
-Any thoughts?
Thanks
|
|
|
|
|
hi
did u try to install the active directory SDK??
it contains all the header files u need.
good luck
The music in my heart I bore
Long after it was heard no more.
- William Wordsworth
|
|
|
|
|
Thank you very much. I will try that.
|
|
|
|
|
I have used the select(); function in an attempt to program a [Timed out] message into my program. In this case the host I am working with is www.ebay.com. You will notice that if you open a command prompt in windows and ping www.ebay.com that you will get four [timed out] output messages sent to the screen. I would like to do the same thing with my program and have chosen to use the select(); function to accomplish this task. The problem is that select(); returns the socket connected to www.ebay.com as readable. How could this be? If I can't use select(); to discover that I have not gotten a reply, how then will I know that no echo reply has been sent back to me?
Thank you,
Eric Sepich
|
|
|
|
|
Remember that a ping is performed at a lower level (ICMP) than a normal socket using select (TCP). Probably the reason you get no response by pinging www.ebay.com, is that the server is not responding to ping requests, and yet does respond to TCP requests (it would have to in order to serve HTTP!). Hence your select returns that it has connected.
|
|
|
|
|
Hi all,
I have an extention dll that export a dialog.
and i have an *.exe client that uses the dll and that dialog.
when even the mouse is over the dialog i want to play a wav here is the code i am using:
void CMyDlg::OnMouseMove(UINT nFlags, CPoint point)
{
HINSTANCE hInstance = AfxGetResourceHandle();
PlaySound(MAKEINTRESOURCE(IDR_BTN_CLICK),
hInstance,
SND_RESOURCE);
CDialog::OnMouseMove(nFlags, point);
}
the sound wav file is at the dll resources.....
the trouble is when look in debug mode at the value of hInstance, i see it points to the exe and not to the dll therefore the wav is not played....
how can i switch the resource???
i know there is a method called AfxSetResourceHandle()
but i don't know what to pass to it????
please help
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Use AFX_MANAGE_STATE(AfxGetStaticModuleState()) at the beginning of the offending functions in your extension DLL. This macro takes care of setting and restoring the resource handle.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi, thanks for the reply
I've tried that already, and i got a compilation error:
mfcs42d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in GUILib.obj
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in GUILib.obj
mfcs42d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in GUILib.obj
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in GUILib.obj; second definition ignored
mfcs42d.lib(dllmodul.obj) : warning LNK4006: __pRawDllMain already defined in GUILib.obj; second definition ignored
remember i am using an extention dll and not regular one.....
can u still help?
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Yes, you're right. Try with AFX_MANAGE_STATE(AfxGetAppModuleState()) instead (and please tell us back )
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|