|
1.I have a question: when i use UDP/IP protocol, sometimes I can receive the data,others are not,if I debug the program, I can receive the data without delaying,I dont know why it happend ,and I have no way to execute it;
2.The completionPort model adapats the UDP/IP protocol,or not?
|
|
|
|
|
are u using multicast udp?
if so remember a lot of routers block udp multicast packets
"there is no spoon" biz stuff about me
|
|
|
|
|
NO,I don't use the Multicast, I use the UDP/IP in the common C/S model, I want to recevie the data use the completionport,
for the chat,....
if you talk about the completionport ,pelease email me , I will send the code to you,
|
|
|
|
|
Hey all.
Just wondering, what would be the best way to find out what the user's windows directory is? (e.g, sometimes its c:\winnt, other times c:\windows, or whatever other ideas the user decides to come up with).
I want to be able to call (HH.EXE) which resides in the users system directory to launch my HtmlHelp files. I realize that I can simply call the .CHM file with shellexecute and that will launch it as long as the file type has been defined. But I want to be on the safe side in case that file type is not defined.
I preferably do not want to have to get the windows directory by accessing the environment variable "windir", but if that is the best way about it, I guess it'll suffice! If so, can someone tell me how to go about accessing this environment variable ... or if there is a better way, enlighten me?
Thanks
Shultas
|
|
|
|
|
I think that unfortunately this is one area you have to read the environment - you didnt say what O/S here, I'm assuming NT.. try this :-
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
char * sysdir = getenv("SystemRoot");
if (sysdir)
cout<<"value of SystemRoot is: "<< sysdir<
|
|
|
|
|
I dont know how accurate this info is, but I'm going to contradict myself and offer this link I found after a quick look see a-la-google (and I just learnt something for today, that there does appear to be some API's for it other than looking in the environment) ..
http://www.qinysoft.com/articles/vcdirectory.htm[^]
hth, 'G'
|
|
|
|
|
TCHAR szBuffer[MAX_PATH];
GetWindowsDirectory(szBuffer, MAX_PATH);
|
|
|
|
|
This is something I haven't mastered for some reason.
I am trying to count the number of elements in a one-dimensional array to loop through it so I figured it would be something like sizeof(array) / sizeof(array[0])
Unfortunately this always returns 1. The array consists of 12 longs (but it is empty to begin with and during the calculation. Do different rules apply to empty arrays, and what is the workaround)
Thanks.
|
|
|
|
|
The sizeof trick only works for staticly allocated arrays. It sounds like you're doing something like:
long* ptr = new long[12]; Since the type of ptr is long* , sizeof(ptr) is 4. ptr[0] is a long , and sizeof(long) is also 4. To do what you want, you would have to write:
long arr[12]; Now sizeof(arr) == 12*sizeof(long) == 48.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
"Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."
-- Paul Watson, Linux Zombie
|
|
|
|
|
I have declared the array staticaly in one function and then passed this empty array in another function (to fill it up) and it is in the second function that sizeof(arr) == 1...I don't understand it!
The function parameter list (2nd one goes something like this)
void(..., ..., long arr[])
{
...
}
|
|
|
|
|
That's because when you pass an array as function parameter, the function always receives a pointer just as if it were declared long* arr . You can't pass an entire array in C.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
Right!!!! I forgot about the "call by" rules!!! Thanks.
|
|
|
|
|
Alternatively you could use the Standard Template Library Vector. Which means you don't have to worry about memory allocations or keeping track of sizes of arrays.
// Declare a vector
std::vector<long> data(12);
// Access Elements
data[0] = ...
data.at(0) = ...
// Add element
data.push_back(...);
// Retrieve size of vector
data.size()
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Hi,
when i m trying to transfer the encoded packet after escape encoding it from client to server using foloowing code snippet.......
AES_EncodeForService(data,key,&res,&len);
// disard <aes_encode> &
strcpy(tempstr,"");
j=0;
for (i=12;i<strlen(res)-13;i++)
{
="" tempstr[j]="res[i];
" j="j+1;
" }
="" ;
="" escape="" encoding...........
="" strcpy(res,"");
="" strcpy(res,tempstr);
="" strcpy(tempstr,"");
="" for="" (i="0;i<strlen(res);i++)
" if="" (="" !(isalnum(res[i])))
="" sprintf(tempchar,"%s%x","%",__toascii(res[i]));
="" else
="" sprintf(tempchar,"%c",res[i]);
="" strcat(tempstr,tempchar);=""
="" combine="" encoded="" with="" tags.....
="" sprintf(withcode,"<aes_encode="">%s",tempstr);
// construct a packet with header followed by footer........
strcpy(packet,header);
strcat(packet,withCode);
// set buffer
len=strlen(packet);
sprintf(sendbuf,"POST /services/ws.asp HTTP/1.0\r\nContent-type: application/x-www-form-urlencoded\r\nContent-length: %d\r\n%s\r\n\r\n",len,packet);
// length of buffer
len=strlen(sendbuf);
// send packet..............
bytesSent = send(ConnectSocket,sendbuf,len,0);
printf("\nBytes Sent: %ld\n\n", bytesSent );
/// receive packet..........
bytesRecv = recv(ConnectSocket,recvbuf,10000,0);
// if doesn't receive the bytes.....
if (bytesRecv <= 0)
printf("\n Error : %d",WSAGetLastError());
// display the received content.........
else
{
printf("\n Receive buffer : %s\n\n",recvbuf);
AES_Decode(recvbuf,key,&recvData,&len);
printf("\n Decode : %s \n\n",recvData);
}
my problem is that the characters which r not aphanumeric get changed and hence does not able to decode it properly.
chirag_a_chauahn
|
|
|
|
|
So what is the problem? Is it the encryption or the data transfer?
Kuphryn
|
|
|
|
|
Okay, so I have this product that modifies a jet database, and now it doesn't work. The program who's database I was modifying switched to MSDE databases. So, I'm assuming that I must do something different programmatically. I just don't know what. Also, I can't even figure out how to create a test MSDE database. I don't even know if it's still a .mdb. Can anyone help?
halblonious
|
|
|
|
|
its not a mdb anymore
its a service running in the background like a proper database
u need to set up an odbc link to it and maybe (this is the horrific part) change ur sql queries cos the syntax is different
msde uses "standard" sql whereas access (jet) didnt
"there is no spoon" biz stuff about me
|
|
|
|
|
Do you have Access? If so, it includes a tool to 'upgrade' your database to SQL Server form. It isn't perfect, but it's a start. In theory, a MSDE database is identical to one made with SQL Server. Try the tool, if you have it, then check the docs on MSDE at MSDN for linking it all together.
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
For one, you no longer have MDB files, you have MDF and LDF files. However, these files are not self-contained like the MDBs, so you can't just move them around. It's best to let SQL Server deal with it if you're just starting out.
For two, if you're using DAO to connect to Access, I'd recommend switching to ADO if possible.
For three, to *easily* manage your database, you'll need a replacement for a tool for a program that comes with the real SQL Server called Enterprise Manager. Here's one such replacement...
http://www.webattack.com/get/sqlexecms1.html[^]
And lastly, SQL Server comes with many tools that MSDE does not. One in particular is the DTS wizard and editor. You can run a DTS package with MSDE, but not create one (unless you do everything via code that is).
The last I heard Microsoft was selling SQL Server Developer Edition for only $49. It's way better to develop your DB with the real deal, and then just bring it over to MSDE when you're done.
Jeremy Falcon
|
|
|
|
|
I am trying to put specified windows under active window.
seemslike it doesn't work don't know why.
source is the following
CRect wkRect;
CMyView* pView = (CMyView*)pDoc -> GetView(RUNTIME_CLASS(CMyView) );
CMDIChildWnd * pChildFrm = ( CMDIChildWnd * ) pView -> GetParentFrame();
pChildFrm ->GetWindowRect( wkRect );
::SetWindowPos( CMDIChildWnd ->m_hWnd, &wndNoTopMost, Pos.x, Pos.y, wkRect.Width(), wkRect.Height(), SWP_SHOWWINDOW);
I have 2 view 1 doc mdi application i want to bring the other behind the window when one of views is activated. what is problem with my source.
Any help is appreciated!
thanks & have a nice weekend to all of you.
Shin
|
|
|
|
|
I am still seeking for the answer.
Shin
|
|
|
|
|
Hello all
I want to program an application which has to retrieve info reg whether the browser is using the proxyserver or not. I found this information in registry under
HKEY_USERS\S-1-5-21-1614895754-1647877149-839522115-500\Software\Microsoft\Windows\CurrentVersion\Internet Settings
But I would like to know whether this works on all windows machines or not. If there's any better way of retreiving this information, pls suggest.
Thanks for your help.
Hari.
|
|
|
|
|
Hi,
Do you want to do that programatically ? HKEY_USERS info is user based. You will find similar such settings under HKEY_LOCAL_MACHINE too.
-Sudha
|
|
|
|
|
Thanks for the reply. I found similar settings in HKEY_USERS.
Hari.
|
|
|
|
|
Ok, I know how to use the GetPixel function, the only problem is that I must get the DC of an inactive/minimized window. I've tried HDC hdc = ::GetWindowDC(hwnd) , HDC hdc = ::GetDC(hwnd) , HDC hdc = ::LockWindowUpdate(hwnd) , but all of them returns -1 when I call the GetPixel function on any pixel of that DC.
If I can figure this out, it would GREATLY help my project.
Thanks a lot in advance
~Mike
|
|
|
|
|