|
If the application in question is on an NT-type box, you can alter the security/permissions of it so that only certain users/groups can execute it. When your service tries to execute the application, it will error out accordingly.
|
|
|
|
|
to hanlde all different formats from around the world
|
|
|
|
|
I'm not sure to have understood your request well. If you want to display a date in a localized format, have a look to the class COleDateTime, and the member function COleDateTime::Format.
All my life, who am I?
|
|
|
|
|
i want to show my window which is derived from CWnd in the button clicked event .the following is my code
void CTmp_dlgDlg::OnButton1()
{
RECT rect;
CString str;
GetWindowRect(&rect);
CMyWnd *mywnd = new CMyWnd;
str = AfxRegisterWndClass( 0);
int ret=myWnd->Create (str,"text",WS_VISIBLE|WS_CHILD,rect,this,1234);
mywnd->ShowWindow (SW_SHOW);
}
CMyWnd::CWnd
but i can't show the window,why?
gucy
|
|
|
|
|
Try
void CTmp_dlgDlg::OnButton1()
{
RECT rect;
CString str;
GetWindowRect(&rect);
ScreenToClient(&rect);
CMyWnd *mywnd = new CMyWnd;
str = AfxRegisterWndClass( 0);
int ret=myWnd->Create (str,"text",WS_VISIBLE|WS_CHILD,rect,this,1234);
mywnd->ShowWindow (SW_SHOW);
}
rechi
|
|
|
|
|
it do not work at all
gucy
|
|
|
|
|
How CMyWnd looks like? I made a test wich draws a line on WM_PAINT and worked just fine.
rechi
|
|
|
|
|
the app the a dialog based app.
i clicked the button on the dialog. nothing changed.
i think it would have pop out a window.
Can i mail the source to you?
gucy
|
|
|
|
|
gucy wrote:
Can i mail the source to you?
Give it to me!
rechi
|
|
|
|
|
but i can't access your email address!
gucy
|
|
|
|
|
I sent you a mail...
rechi
|
|
|
|
|
Hi,
I have a CArray - m_array < STRUCT1, STRUCT1 > and I want put his to the CMap < DWORD, DWORD, m_array, m_array >. How to make this?
Best regards,
Eugene Pustovoyt
|
|
|
|
|
The simple answer is you can't, not directly. CArray does not have a copy constructor or assignment operator, so it won't work. There are a couple of workarounds however.
1. Make a class that has the array as a member, and define copy constructors and assignment operators that copy the array elements.
2. Derive a class from CArray and implement the copy constructor and assignment operator, and use this class with the map.
I would choose the second option - it is still a CArray, rather than having to go through another class.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Thanks.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
You're welcome
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Another option (the MFC way) is to use the MFC collection classes, which can be nested this way. EX:
CMapWordToOb oMap;
CObArray *pArray = new CObArray;
pArray->Add(..);
oMap.SetAt(KeyValue,pArray);
The bonus of doing this in this way is that it is directly Serializable.
onwards and upwards...
|
|
|
|
|
Yes, but he said he wanted to put a CArray in a CMap, not a CArray* (yes, I know it's pedantic )
basementman wrote:
The bonus of doing this in this way is that it is directly Serializable.
Good point. I didn't think of that
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Hi all,
I am in desperate need to know the dynamic IP allocated to a user when he browses by the ISP, also I want to know the Browser Language..can anyone show me some pointers or ideas or tutorials to do this..any sort of help is highly appreciated...Thanks a lot in advance...
Himanshu
|
|
|
|
|
Here is a code snippet that may be called more than once. The first time will return how many NET I/O addresses are available, a second call may nominate which of the available IP addresses to return. Hope this helps...
cheers
WillB
//*****************************************************************
//** **
//** **
//** **
//** G E T H O S T N A M E **
//** **
//** **
//** **
//*****************************************************************
int MNF_GetHostIPAddress( CString & rszHostName,
CString &rszHostIPAddress,
int nIPSelection)
{
int nIPCount = 0;
in_addr **papIPAddressList;
HOSTENT *ptHostEnt = NULL;
rszHostIPAddress = "";
// ---> ----------------------- <---
// ---> Discover IP address(es) <---
// ---> ----------------------- <---
ptHostEnt = gethostbyname( rszHostName );
if ( ptHostEnt != NULL )
{
papIPAddressList = (in_addr **)&ptHostEnt->h_addr_list[ 0 ];
// ---> ----------------------- <---
// ---> Count the IP Addressess <---
// ---> ----------------------- <---
while ( papIPAddressList[ nIPCount ] != NULL )
{
nIPCount++;
}
if ( nIPSelection < nIPCount )
{
rszHostIPAddress = inet_ntoa( *papIPAddressList[ IPSelection ] );
}
}
return nIPCount;
}
|
|
|
|
|
Thanks for the code snippet..but I guess it doesnt work properly, as we will have to pass some arguments..I dont want to pass any prguments into it and want to know the IP address of the machine assigned by the ISP. Not the local IP I can do that. How to get the ISP provided IP. Please help.Any help or pointers are appreciated..
Thanks in advance.
Himanshu
|
|
|
|
|
The "IP Helper API" is the keyword you're looking for and here's a snippet of the code that I've written to gather all IP addresses assigned to the system:
ULONG adpsize = 32768;
void* adpinf = malloc(adpsize);
if (GetAdaptersInfo((PIP_ADAPTER_INFO) adpinf, &adpsize) == ERROR_SUCCESS)
{
PIP_ADAPTER_INFO pip = (PIP_ADAPTER_INFO) adpinf;
while (pip)
{
PIP_ADDR_STRING ips = &pip->IpAddressList;
while (ips)
{
ips = ips->Next;
}
pip = pip->Next;
}
}
free(adpinf);
Regarding your question about the language of the OS you can use GetSystemDefaultLangID from the Win32 API, if I understood your question correctly.
|
|
|
|
|
Thanks for the language thing...can you please tell the dependencies etc..i am unable to compile ur code..i used iphlpi.h and its lib file in link..but still it is not compiling and can you message the IPS issued from this code..I shall be highly obliged if u can revert back asap..
thanks in advance..
Himanshu
|
|
|
|
|
The only dependency is iphlpapi.lib which comes with Platform SDK I guess, you should download & install it if you haven't already done so. If it gives a linker error then that's the case, if not could you please paste the error lines?
When I run this on my computer I get two IP addresses, cause I have two ethernet adapters: one for my LAN and one for my cable connection to the Internet. Back to your question, a dialup adapter is a virtual adapter and thus if the ISP has assigned an IP to your computer via DHCP, you should get it in that loop as well. In your case, if the host computer has more than one IP address such as mine, you should have your own way of differentiating it from the other IP addresses, such as checking for the type of the adapter, looking for a name etc...
Sorry for the late response, I've been sleeping all day
|
|
|
|
|
Hi,
Thanks for ur sooner reply..I dont have any errors now..but I cannot understand the parameters to be passed..CString& rszHostName,CString& rszHostIPAddress, int nIPSelection..please guide.and reply soon..I shall be waiting for ur response. Thanks a ton in advance..
Himanshu
|
|
|
|
|
Hi Himanshu,
Sorry but I really don't think that I do understand. Weren't you asking for the IP address of the local computer? Now say that's the rszHostIPAddress parameter. What are the other two? You've mentioned above you needed a function which receives no parameters, now you want to pass parameters to it?
The method I've described above let's you get the IP addresses assigned to a computer, note that whilst a computer has a single hostname, it can have many IP addresses. And that about nIPSelection, I really don't understand, sorry...
|
|
|
|