|
Sebastian Schneider wrote: If you think about it, each real-world construction company would need access to the building site in order to complete its contract. If they were not allowed on site, they could not build there, right?
Hmm.... Nice way to explain things. Very interesting...;)
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
|
i am making a application which will transfer messages in lan but my transfer messages to other machine but when i try to send messages to own machine then it do not receive message so what is the problem please tell me ASAP.
bankey.khandelwal@solversa.com
Thanks N Regards
Bankey Khandelwal
Mobile : 98504-32990
Office : 020 25521888
Solversa Technologies
15, Yeshwant Ghadge Nagar,
Range Hill Road,
Pune - 03,Maharashtra,India.
|
|
|
|
|
Did you get any error messages?
What's the errno?
Kevin
|
|
|
|
|
Bankey Khandelwal wrote
when i try to send messages to own machine then it do not receive message
whether ur getting same problem when sending tyo other system in LAN.
never say die
|
|
|
|
|
has ur application bound to some port to listen to incoming messages?
-Prakash
|
|
|
|
|
Hey Bankey pls describe your problem in detail
so others on the forum are be able to help u
Enjoy in pune
Ok
bye
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
when I call FindFirstPrinterChangeNotification(),
in release ,Get Fail,the Error code is 997,it mean the overload I/O is handing.....
but In debug,it's ok!
why?
thanks
|
|
|
|
|
can you post part of the code that is making the API call?
-Prakash
|
|
|
|
|
/* reinitialize the Termination Event so we can proceed */
ResetEvent(g_hTerminateEvent);
hPrinterNotification = FindFirstPrinterChangeNotification(
ThreadParam.hPrinter, /* The printer of interest */
PRINTER_CHANGE_DELETE_JOB, /* We need to know when a job is removed */
0, /* reserved */
&NotificationOptions); /* The details of what notifications that are needed */
/* Check for an error */
if (hPrinterNotification == INVALID_HANDLE_VALUE)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
LocalFree( lpMsgBuf );
return 0;
}
/*
* Loop on the Notifications, a terminate event, or a refresh event
*/
/* setup for a WaitForMultipleObjects */
Handles[0] = hPrinterNotification;
Handles[1] = g_hTerminateEvent;
Handles[2] = g_hForceRefreshEvent;
/* Initialize for our local data structure */
ZeroMemory(&Queue, sizeof(Queue));
Queue.Printer.hPrinter = ThreadParam.hPrinter;
/* Initialize the display and our local copy of the printer queue data */
CPrinterJob::Refresh(ThreadParam.hWnd, &Queue);
/*
* Loop while we are stilling waiting on Notifications.
*/
while (hPrinterNotification != INVALID_HANDLE_VALUE)
{
/* wait for a printer notification, terminate event, or refresh event */
WaitForMultipleObjects(3, Handles, FALSE, INFINITE);
/* check to see if the thread needs to quit. */
if (WaitForSingleObject(g_hTerminateEvent, 0) == WAIT_OBJECT_0)
{
/* This should be the only way out of the loop */
FindClosePrinterChangeNotification(hPrinterNotification);
hPrinterNotification = INVALID_HANDLE_VALUE;
}
/* or check to see if the notification object for the printer queue is signaled */
else if (WaitForSingleObject(hPrinterNotification, 0) == WAIT_OBJECT_0)
{
/* get the changes and reset the notification */
if (!FindNextPrinterChangeNotification(hPrinterNotification,
&WaitResult, /* for the PRINTER_CHANGE_DELETE_JOB notice */
&NotificationOptions, /* The notifications */
(void **)&pNotification)) /* address of pointer that gets what changed */
{
//ErrorBox(GetLastError(), "FindNextPrinterChangeNotification");
int iiii = 0;
}
/* Did a notification overflow occur? */
if (pNotification && pNotification->Flags & PRINTER_NOTIFY_INFO_DISCARDED)
{
/* An overflow of notifications occured, must refresh to continue */
OldFlags = NotificationOptions.Flags;
NotificationOptions.Flags = PRINTER_NOTIFY_OPTIONS_REFRESH;
FreePrinterNotifyInfo(pNotification);
if (!FindNextPrinterChangeNotification(hPrinterNotification,
&WaitResult,
&NotificationOptions,
(void **)&pNotification))
{
//ErrorBox(GetLastError(), "FindNextPrinterChangeNotification refresh call.");
int jjjj = 0;
}
NotificationOptions.Flags = OldFlags;
/* Start Over with Refreshed Data */
CPrinterJob::Refresh(ThreadParam.hWnd, &Queue);
}
/* process the notification of changes */
if (WaitResult & PRINTER_CHANGE_DELETE_JOB)
{
/* a job was deleted so start over clean */
CPrinterJob::Refresh(ThreadParam.hWnd, &Queue);
}
else
{
/* track and show the changes */
CPrinterJob::RefreshFromNotification(ThreadParam.hWnd, &Queue, pNotification);
}
FreePrinterNotifyInfo(pNotification);
pNotification = NULL;
}
/* Or, maybe the user wants to refresh the view of the print queue */
else if (WaitForSingleObject(g_hForceRefreshEvent, 0) == WAIT_OBJECT_0)
{
CPrinterJob::Refresh(ThreadParam.hWnd, &Queue);
ResetEvent(g_hForceRefreshEvent);
}
Sleep(5);
}
/* Done watching for notifications, cleanup */
ClosePrinter(ThreadParam.hPrinter);
CPrinterQueue::FreeQueueData(&Queue);
/* Thread posts the close message when the application is going away so the
* the application willattempt to close down again and succeed since the
* thread has died.
*/
if (bCloseApp)
PostMessage(ThreadParam.hWnd, WM_CLOSE, 0, 0);
return TRUE;
|
|
|
|
|
How can I programmatically make a button invisible?
I can enable or disable and I can go into properties and
make the button invisible (or visible), but how can I
make it invisible programatically at run-time?
Please, any response any one can give me will be
greatly appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
|
I have a dialog-based app that:
- displays an image in a picture control (CStatic)
- has a bunch of labelled text boxes (CStatic & CEdit)
- has a few other bits & pieces (CScrollbar, CComboBox, CCheckBox...)
The app needs to fill as much of the available screen real-estate on the computer running it. I can resize the main dialog window easily enough... but resizing the various controls on it looks like a tedious business.
It's a one-off. Am I just as well off doing the layout calculations by hand, and giving every text box label an ID other than IDC_STATIC to do it... or is there something there that will so dramatically reduce the pain of all this that it is worth learning. On the face of it, CResizableDialog is more effort than it's worth... but I stand to be corrected.
|
|
|
|
|
I believe there's a CP class that does this as well, but you'd have to have a look for yourself, I'm not sure.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
See the "Extras" section of this article.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Thanks guys --- I ended up biting the bullet and doing it "longhand". One day I may refactor it into something like what was in David's "extras"... but it would take considerably more sophistication to cope with the kind of form layout I have --- lines with 3 or 4 edit boxes across the full screen needing to be resized proportionally in the horizontal direction, while their labels stay constant size; image "window" resized to take up the remaining space among the edit boxes & buttons...
|
|
|
|
|
That's what I do too, doing each control 'by hand'. I reckon it can give a much better appearance, as various things need different changes.
In fact, in some dialogs I even alter the layout as the size changes. It can be a bit of a pain to do, so it is worth doing methodically, and commenting clearly. It is easy to get into a muddle doing this kind of thing.
Oh, I also take screen images and load these into graphics software so that I can enlarge them enough to be able to count the pisels.
Shraddhan
|
|
|
|
|
Hello!
I got class CMyClass:
class CMyClass<br />
{<br />
private:<br />
CString Name;<br />
public:<br />
CString GetName() const;<br />
};
I want to make list of objects CMyClass, so I do:
typedef list<CMyClass> MyLst;<br />
MyLst MyList;
Now I want to make list of iterators to my previous list, so I do:
typedef list<MyLst::iterator> pMyLst;<br />
pMyLst pMyList;
Let's assume I have some elements in list MyList and I want to fill list pMyList with iterators from MyList list:
for (MyLst::iterator it = MyList.begin(); it != MyList.end(); it++)<br />
pMyList.push_back(it);
Now I would like to retrieve some data from my iterator list, and I do:
for (pMyLst::iterator it = pMyList.begin(); it != pMyList.end(); it++)<br />
{<br />
CString Name;<br />
Name = (*it)->GetName(); // program crashes here
}
Help!
|
|
|
|
|
Mateusz Karbowy wrote: (*it)->GetName();
You didn't store pointers, so why are you using -> instead of . ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
He stored iterators, which are conceptually very similar to pointers. (*it) gives the iterator he stored and (*it)-> returns the object referred to by the stored iterator.
Steve
|
|
|
|
|
I don't think that is true. In any decent compiler, you may not treat an iterator as a pointer, and once you dereference the iterator, you get the object you stored, not a pointer to it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
typedef list<CMyClass> MyLst;
A list of CMyClass s
typedef list<MyLst::iterator> pMyLst;
A list of iterators into a MyLst
pMyLst pMyList;
Contains list<CMyClass>:iterator s ("expanded" typedef).
(*it)->
Calls operator-> on a list<CMyClass>::iterator
Steve
|
|
|
|
|
Stephen Hewitt wrote:
Calls operator-> on a list<CMyClass>:iterator
OK, I get it now. The problem is that there's a list of lists here. I didn't spot that. I *never* use typedefs with STL for this reason, it just obsfucates the code.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I don't believe a list of iterators is the right approach. Why would you store iterators, instead of the underlying objects ? Store pointers to your class, if you want them to point to the same object.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|