|
Hello!
Question about UDP connections.
Is there a way to determine the destination port/address from an(y) active open UDP socket on my system?
Maybe a workaround or simple solution without using winpcap.dll.
<view next="">
|
|
|
|
|
I'm not sure but google on raw sockets I think you will find some info...
Well... I am a beginner ...
|
|
|
|
|
|
Hello,
For some reason when trying to compile, I keep getting error that TrackMouseEvent is an undeclared identifier. The TRACKMOUSEEVENT struct, however, compiles without problem. I have user32.lib imported in my project settings and I have the dll, and I have winuser.h included in my project (along with windows.h). I am running the MS platform SDK from Feb 2003.
Help?? What could be wrong?
Thank you
|
|
|
|
|
Got to command prompt.
Dump the exports from user32.dll and see if TrackMouseEvent is in there.
DumpBin /Exports User32.Dll
If not, then heed this warning and adjust your code and project accordingly:
Note The _TrackMouseEvent function calls TrackMouseEvent if it exists, otherwise _TrackMouseEvent emulates TrackMouseEvent. The _TrackMouseEvent function is in commctrl.h and is exported by COMCTRL32.DLL.
|
|
|
|
|
First of all I must admit, I am not a very experienced COM programmer.
But I managed to create my own COM automation server (exe). It runs well and can be used by clients on my development system. Now I am trying to package the server for installation on other systems.
I think I have properly created registry entries for CLSIDs etc. - at least to the best of my knowledge. Nevertheless, when a client calls "CreateDispatch" the instantiation of the server application fails. CreateDispatch returns "Server execution failed." When looking at the event viewer, I see the following message:
Source: DCOM
Category: None
Type: Error
EventID: 10010
Description: The server {CLSID} did not register with DCOM within the required timeout.
Any ideas? Am I missing something?
Comments greatly appreciated.
Jochen
|
|
|
|
|
Hi all,
i am working on an application that interacts with a print driver. However, when i use the Win32 API calls (EnumJobs, etc.) to determine what file was printed and where it was located, i can only get the file name (not the path). In some cases, i will need to do some examination of the contents of a file - so i need the path. Does anyone know how to obtain such a thing (i fear it doesn't exist)?
|
|
|
|
|
the_grip wrote:
Can the path to a file be determined from a print job?
I don't think so. When you print a file, you do so with some application that reads the file, make API calls to create a print document with some name, draw some content in it, and ends the operation. You then can see the print queue in the operating system, but the OS knows nothing about whether what it has to print was based on a file, its location, or its content. The print document may have the same name as some file, but for the OS it's just a name and nothing else.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
can you just write a class to manipulate bits in an int, so it would contain 32 bool values instead of wasting that one number for 1 or a char for 8 values or double for 64 diff. values, wouldn't this be a better solution?
IM PROUD TO BE A GMAIL;
|
|
|
|
|
|
|
why don't you do it yourself ? is it so hard ?
look at this[^]...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Back in the old days of C when every byte of memory counted, we used to define a structure of bits so that it would be clearly referenced in code and only use a byte of memory. So, to declare six flags in a byte, you would define a struct like this:
typedef struct _tagBitFlags
{
unsigned char Flag1 : 1;
unsigned char Flag2 : 1;
unsigned char Flag3 : 1;
unsigned char Flag4 : 1;
unsigned char Flag5 : 1;
unsigned char Flag6 : 1;
unsigned char unused : 2;
} BitFlags;
Then to access the flags, you could write something like this:
if (BitFlags.Flag1)
printf("Flag1 is set");
else
printf("Flag1 is cleared");
Note that the value you can set a flag to must be in the bit range that the structure member can hold. This means that if, as in the above example, Flag1 is declared as one bit, it can only hold the values 0 and 1, whereas unused is declared as two bits and can be assigned the values 0, 1, 2, or 3.
Hope this doesn't date me too badly....
onwards and upwards...
|
|
|
|
|
Not at all. I am glad you typed it in. Saved me some work
|
|
|
|
|
Glad to be of service... and glad that I can remember back that far...
onwards and upwards...
|
|
|
|
|
Why don't you try the bitset from STL[^]?
You can easely do the following things:
typedef std::bitset<8> Flag8;
typedef std::bitset<11> Flag11;
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Imagine the following situation:
class A<br />
{<br />
public:<br />
A(int x, int y) {...}<br />
};<br />
<br />
int func1()<br />
{<br />
return ...;
}<br />
<br />
int func2(int arg)<br />
{<br />
return arg / 2;
}
You can not change the above. But you need to inherit from A and you want to pass func1() as the first argument and func2 of the first argument as the second argument to the constructor of A:
class B : public A<br />
{<br />
public:<br />
B():A(func1(), func2())<br />
{<br />
} <br />
};
What do you think is the best way to do this? A possible solution is:
class B : public A<br />
{<br />
protected:<br />
B(int x, int y):A(x, y))<br />
{<br />
} <br />
<br />
public:<br />
static B create()<br />
{<br />
int f1 = func1();<br />
return B(f1, func2(f1));<br />
}<br />
};
However, this would obstruct future inheritance from B.
|
|
|
|
|
How about the following?
<br />
class A2 : public A<br />
{<br />
protected:<br />
A2(int arg) : A(arg, func2(arg))<br />
{<br />
}<br />
};<br />
<br />
class B : public A2<br />
{<br />
public:<br />
B() : A2(func1())<br />
{<br />
}<br />
};<br />
Another possibility:
<br />
class B : public A<br />
{<br />
public:<br />
B(int x, int y) : A(x,y)<br />
{<br />
}<br />
<br />
B()<br />
{<br />
int f1 = func1();<br />
B aux(f1, func2(f1));<br />
*this = aux;<br />
}<br />
};<br />
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
The first one is nice indeed.
|
|
|
|
|
Hi CPians,
I would like to change programmatically the version information of a file (e.r. the ones you get when you open the properties dialog of a file in the explorer). This is for adding revision information automatically.
I know how to access this data (GetFileVersionInfo ,GetFileVersionInfoSize and similar) but how can I modify it ?
Thanks,
~RaGE();
|
|
|
|
|
Use RT_VERSION with this.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks for the answer David, but this is only for Word documents, isn't it ? I was actually hoping to change the properties of any file (Word document, text file, ...).
~RaGE();
|
|
|
|
|
Rage wrote:
...but this is only for Word documents, isn't it ?
No, it works for others too.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
//header file
/////////////////////////////////////////////
node* next;
};
class cqueuetype
{
public:
cqueuetype();
void EnqueueRear(node* newNode);
void display();
bool isempty();
void makeEmpty();
void save();
void load();
void find();
void find1();
char infile();
void num_of_memo();
private:
node* rear;
node* front;
int counter;
};
//////////////////////////////////////////////
//Part of da cpp
//////////////////////////////////////////////
void cqueuetype::save()
{
node* saving=front;
ofstream outfile("c:\\queue.txt",ios::out);
if(!outfile)
{
cout<<"Can not find drive"<<endl;
}
="" else
="" {
="" outfile<<counter<<endl;
=""
="" while="" (saving="" !="NULL)
" outfile<<"title:"<<endl;
="" outfile<<"="" "<<saving-="">Title<<endl;;
outfile<<"date="" &="" time:"<<endl;
="" outfile<<"="" "<<saving-="">Date_Time<<endl;
outfile<<"memo:"<<endl;
="" outfile<<"="" "<<saving-="">Content<<endl;
outfile<<"....................................."<<endl;
="" saving="saving-">next;
}
outfile.close ();
}
}
And here is an example of da file it saved
2
TITLE:
Bad Day
Date & Time:
06/19/2005 04:19:27 PM
MEMO:
Today is da worst day in my life..
.....................................
TITLE:
Good Day
Date & Time:
06/20/2005 04:19:27 PM
MEMO:
Today is a Good day.
.....................................
Now this (2) is the number of memos in my file
but now i got a problem which is...as soon as close my programe and run it again , and ask da program to display da memos , it cant display it well , cause it cant read it from da file...
da other problem is , if i added a new entry before i load da file , all da old enteries will be deleted... it will over write on it...
So... i need to know what shall i do , and what is da prober load function i can use , where i have 3 string , in dat node i load....
My regards ,
Bahy
|
|
|
|
|
ana_bahy wrote:
and ask da program to display da memos , it cant display it well , cause it cant read it from da file...
That's normal because when you open the file, its contents are destroyed. Try to use that instead:
ofstream outfile("c:\\queue.txt",ios::out | ios::app);<br />
ana_bahy wrote:
da other problem is , if i added a new entry before i load da file , all da old enteries will be deleted... it will over write on it...
We cannot guess what's happening during the load if you don't post the code.
And please, use the formating tags to make your code look better (it is just above the emoticons, use the 'code' or 'pre' tag).
|
|
|
|