|
Slowly running out of words?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
veer_in wrote: I am following steps from following link [...]
And which part of
Create a GUID for your main interface.
* On Windows you can use the guidgen utility. you were unable to comprehend?
Use guidgen (among the tools in your VisualStudio Tools Menu, or on your HD among the other VisualStudio tools).
This is - as trivially follows from the phrase "...for your interface..." - YOUR_INTERFACE_GUID.
The same way, you create a guid for your application and use it whereever YOUR_COMPONENT_GUID is asked for.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Yeah, I cud use that VisualStudio Tools Menu Guid utility..But that is for Component of interface?
If it is for interface then how can i generate for Component? Is there any other utility?
Thanks.
|
|
|
|
|
Have you even tried it? Everytime you call the tool, you get a unique guid. A different one.
So when asked by the tutorial you are following, you create a guid for the interface.
Later, when asked to create one for the app, you create another one.
Its really that simple.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
As others have said, use guidgen. But sometimes your program may need to create them on the fly:
CString GUIDgen()
{
GUID guid;
CoCreateGuid(&guid);
BYTE * str;
UuidToString((UUID*)&guid, &str);
CString unique((LPTSTR)str);
RpcStringFree(&str);
unique.Replace(_T("-"), _T("_"));
return unique;
}
|
|
|
|
|
|
Hi,
I want to display a report containing four columns and to provide printing option for that. My code is:
<br />
<br />
void CColorView::OnDraw(CDC* pDC)<br />
{<br />
<br />
CDocumentationDoc* pDoc = GetDocument();<br />
<br />
if(pDC -> IsPrinting())<br />
{<br />
<br />
pDC -> SetMapMode(MM_ISOTROPIC);<br />
<br />
pDC->SetMapMode(MM_ISOTROPIC);<br />
pDC->SetWindowExt(500, 500);<br />
pDC->SetViewportExt(4500, 6500);<br />
<br />
}<br />
<br />
pDC -> TextOut(30, 10, "COLOR");<br />
pDC -> TextOut(280, 10, "DEV-TYPE");<br />
pDC -> TextOut(600, 10, "VALUE");<br />
pDC -> TextOut(730, 10, "QUANTITY");<br />
<br />
int xinc = 40, yinc = 20, ytemp = 50;<br />
<br />
int size = FootPrintArray.GetSize();<br />
<br />
for(int i = 0; i < size; i++)<br />
{<br />
<br />
footprint = (FootPrint*) FootPrintArray.GetAt(i);<br />
<br />
BYTE red, green, blue;<br />
<br />
red = ((BYTE*)(&footprint -> color))[0];<br />
green = ((BYTE*)(&footprint -> color))[1];<br />
blue = ((BYTE*)(&footprint -> color))[2];<br />
<br />
CPen penShadow(PS_SOLID, 1, PALETTERGB(red,green,blue));<br />
CPen* ppenOld = pDC -> SelectObject(&penShadow);<br />
<br />
CBrush brCenter;<br />
brCenter.CreateSolidBrush(PALETTERGB(red,green,blue));<br />
CBrush* pbrOld = pDC -> SelectObject(&brCenter);<br />
<br />
int yval = ytemp + (i * yinc); <br />
<br />
pDC -> Rectangle(30, yval - 10, 70, yval);<br />
pDC -> TextOut(100, (yval - 10), footprint -> FtPtName);<br />
pDC -> TextOut(600, (yval - 10), footprint -> Value);<br />
pDC -> TextOut(770, (yval - 10), footprint -> Quantity);<br />
<br />
} <br />
<br />
<br />
}<br />
It is getting printed now.. i can able to take pdf from my view. But in this the row values of the columns 2 and 3 may vary to any large value at run time. How to calculate and print? Suggest me some ideas.
With Regards,
Sangeetha.
|
|
|
|
|
for getting the size of a string in CDC call CDC::GetTextExtent() method.
|
|
|
|
|
I need to calculate the text extent of a largest string at run time and position the column heading centered.
With Regards,
Sangeetha.
|
|
|
|
|
Hi
I have created 2 class derived from CPropertyPage and one class from CPropertySheet.
Font of these 2 dialogs(property pages) are Tahoma (I set it in resource editor), but when run the exe font has been changed to a another font.
I tried SetFont in my propert sheet and propert pages classes but it does NOT change the font!
Please help
|
|
|
|
|
any relevant piece of code to show what you did ?
|
|
|
|
|
I think it must work correctly without any code, just like changing font of a dialog in resource editor, for this you don't need to write any code!
But here is my try :
in my property page and property cheet constructor :
{
m_font.CreateFont(8,
0,
0,
0,
FW_NORMAL,
FALSE,
FALSE,
0,
ARABIC_CHARSET,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_ROMAN,
_T("Tahoma"));
}
in their OnInitDialog() :
SetFont(&m_font);
but after I compile the project and run the program, the font of propert pages are not Tahoma, I think it's MS Shell Dlg
|
|
|
|
|
Hadi Dayvary wrote: OnInitDialog() :
SetFont(&m_font);
That may be to late. The Text may have already been drawn.
Try SetFont() in Create() or PreSubclassWindows().
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
wrong... i once wrote the following code in a OnInitDialog() handler, and the code was working as expected :
CFont* pf = m_staticTransparent.GetFont();
LOGFONT lfLogFont = {0};
pf->GetLogFont(&lfLogFont);
lfLogFont.lfWeight = FW_BOLD;
m_fontBold.CreateFontIndirect(&lfLogFont);
m_staticTransparent.SetFont(&m_fontBold);
|
|
|
|
|
toxcct wrote: wrong...
Why I said "...might be too late..."
I always used Create() or PreSubclassWindows() and it worked for me.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
i am working on registry cleaner for window xp and window vista using
class RegistryClass_src.zip.the function DeleteValue is working
fine on window xp but DeleteKey function is not working here and please
guide me how to identify or develope software to clean the registry value which is erroneous or unused or invalid key in registry of window xp or vista
|
|
|
|
|
If you are talking about an article put your comment there
Russell
|
|
|
|
|
niki dutta wrote: i am...using class RegistryClass_src.zip.
You might consider asking your question here as the author would obviously be more familar with the code. Asking the same question 2+ hours later shows little patience on your part.
In any case, why are you not stepping into the DeleteKey() (which is simply a wrapper around RegDeleteKey() ) to find out the reason for the failure?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am writting a little server ..
And using nob-blocking socket.. my problem is
send(socket,data,sizeof(data),...);
send(socket,data,sizeof(data),...);
This would be no problem for blocking socket .. but since blockign sockets would kill my server..
Data get somehow mixed .. by the recver..
I need something like a check.. to check if data is still sending..
send(socket,data,sizeof(data),...);
if (??DATA_STILL_SEND??)
{
wait bla bla bla..
}
Send(socket,data,sizeof(data),...);
I hope you can help me somehow ~.~
|
|
|
|
|
BakaBug wrote: I need something like a check.. to check if data is still sending..
No. What you need is to check the return value from send().
Windows Sockets will buffer/send the data in the order you call send.
BUT, when the send buffer is full, send() will return the number of bytes
it was able to queue, which may be less than you tried to send.
You need to code to re-send bytes that don't get sent the first try.
This also applies to recv() - a SUCCESSFUL call to recv() may recv only ONE BYTE,
even though you requested to receive more!
Very important
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hmm thx for you help.. I will try..
I only hope it nvm if my packet get cut.. because it have such structure.
struct Packet
{
WORD size;
char data[...];
};
I am not sure if the client will rerecv the packet.. when it get cut ~.~
Mean I don't have source of it.. lol It's a finish client.. I only write a server for it
But thx I will try
|
|
|
|
|
If you're using a streaming protocol like TCP, sockets only understands bytes -
it knows nothing about structures.
You need to send until all the bytes you want to send are sent.
You're also responsible for knowing what to recv on the other end.
You need to recv until you've received all the bytes you're expecting.
There's lots of ways to implement it, the simplest being a loop - something like:
Packet packet;
...
int BytesToSend = sizeof(Packet);
const char *pBytesToSend = (const char *)&packet;
while (BytesToSend > 0)
{
int BytesSent = ::send(socket, pBytesToSend, BytesToSend, 0);
if (BytesSent == SOCKET_ERROR)
{
int SockErr = ::WSAGetLastError();
if (SockErr != WSAEWOULDBLOCK)
{
break;
}
BytesSent = 0;
}
pBytesToSend += BytesSent;
BytesToSend -= BytesSent;
} The code for receiving is similar except recv() returns 0 when the socket closes.
Note that looping on recv() is bad unless you know you're expecting incoming bytes.
Receiving is better done on a blocking socket in a separate thread or using a non-blocking
socket in a loop controlled by the async FD_READ event (so the loop isn't always spinning
waiting for incoming bytes).
Since your packet struct has a size member, you can make it more efficient by sending
the size member and only the number of bytes indicated by the size member.
On the receiving end, receive just a WORD (the size - note that receive may take two
tries to get the entire WORD!)). Now with that size, you know how many bytes to receive
into a Packet struct.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
So my problem was really...
My data don't get mixed...
My data got cut .. and i didn't send 100% ~.~ ajaja
I work now for ~3years on sockets and internet-stuff..
But i really looked for such a info ~.~ (maybe I searched wrong ?)
But hehe thx now I understand It a little more..
I will add this to my Server..
But .. I looked msnd..
and found this:
WSAAsyncSelect
unsigned int wMsg1=0;
WSAAsyncSelect(Socket, NULL, wMsg1, FD_READ);
I understand it like.. I can look with the function .. if the buffer is ready for new data or not..
Or I am wrong ? msdn is sometimes really confusing to me ..
|
|
|
|
|
WSAAsyncSelect() and/or WSAEventSelect() can help your asynchronous sockets by
sending you a window message or setting an event when certain network events occur.
To receive a window message when there's data available to be received from the socket
you can use something like
WSAAsyncSelect(Socket, hwndNotifyWindow, MY_WM_SOCKETEVENT, FD_READ);
The window with the handle "hwndNotifyWindow" will receive a "MY_WM_SOCKETEVENT"
window message, which will have an error code and event code encoded in the LPARAM.
Note that the FD_READ event just tells you there's SOME data available to be read from
the socket. It's still up to you to keep track of how much data is received - it may be
received in chunks a different size than the way data was sent.
You may also want to monitor FD_CLOSE events as well.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thx a lot .. fixed all my problems now.. and it works fine
|
|
|
|
|