|
So, it's the Wild West out there in WM-land
Do you mean that mfc already uses them, or just some thirth party libraries?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
I mean windows already use them.
MFC i dont know about, maybe.
But since the messages go to the windows you send them to, you can
reuse the ID's.
..but anyway, better safe than sorry i think.
/Magnus
|
|
|
|
|
From MSDN
WM_USER
Range Meaning
0 through WM_USER – 1 Messages reserved for use by the system.
WM_USER through 0x7FFF Integer messages for use by private window classes.
WM_APP through 0xBFFF Messages available for use by applications.
0xC000 through 0xFFFF String messages for use by applications.
Greater than 0xFFFF Reserved by the system for future use.
WM_APP
Range Meaning
0 through WM_USER – 1 Messages reserved for use by the system.
WM_USER through 0x7FFF Integer messages for use by private window classes.
WM_APP through 0xBFFF Messages available for use by applications.
0xC000 through 0xFFFF String messages for use by applications.
Greater than 0xFFFF Reserved by the system for future use.
Look up WM_APP and WM_USER for more info
Michael
|
|
|
|
|
...Ok, so I don't have to bother about maximum values
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
How do you get the filename and path of an application's .exe?
I'd like to read and write files in my MFC application's directory, which is not always equivalent to the current working directory when it starts.
Thanks for your help.
|
|
|
|
|
GetModuleFileName(NULL) .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That was quick! Thanks, that's exactly what I was looking for.
|
|
|
|
|
Hi, We all know that we can set the minimum one milliseconds elapse time with SetTimer function. Can anyone tell me how to set less than 1 ms say 500 micro seconds?
|
|
|
|
|
Have a look at
http://www.codeproject.com/system/timers_intro.asp#MMTimers
|
|
|
|
|
You will want to look at QueryPerformanceCounter and QueryPerformanceFrequency . Most computers now have this high resolution timer, however some of the older ones do not. IN those cases you will have to rely on the Multimedia timer which has a resolution of 1 millisecond.
By the way, I believe the timer resolution on the system timer with WM_TIMER has a resolution of 55 milliseconds.
Good Luck.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Is it S_OK to use W2A to convert from a BSTR to a const char * ?
Means, can I do this?
const char * p = W2A(bstrBlah);
Nish
p.s. I am doing this now and without any problem. But I just wanna know if it is safe!
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
|
Yes, a BSTR holds Unicode characters, so W2A() is perfectly fine.
<nitpick>
Since you're assigning to a const char*, use W2CA() instead.
</nitpick>
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
|
|
|
|
|
Michael Dunn wrote:
use W2CA() instead
Thanks Mike
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Dear All,
APPLICATION:
To run two processes simultaneously
Brief Description of Project
64 i/os are interfaced using 8 i/o modules that communicate with PC via RS232/RS485 converter. Modules are microcontroller based which give input data to PC coming from the machine and pass on the output data generated by the PC, back to the machine.
The code is written in VC++ and used multithreading for parallel process. The operation needs some TIMERS for wait process.
Following are the queries:
1 The process demands TIMERS are to be continuously monitored for elapsed time and saved in an .ini file format when thread is in running state. Can anyone suggest the right method of doing so?
2 Only two threads are being used. Here, we are using ‘SwitchToThread()’ function to switch the system resources between two processes. Is this the right method ?
Following is the brief code we have used:
CreateThread() T1 // in SDK DLL
{
Function1(); // To read the .ini file for process 1
{
SwitchToThread();
}
}
CreateThread() T2 // in SDK DLL
{
Function2(); // To read .ini file for process 2
{
SwitchToThread();
}
}
Please spare some time and give me your valuable suggestions.
|
|
|
|
|
I would use WaitforMultipleEvents -Stuff in addition to some timing events.
|
|
|
|
|
Hi
How can i transfer some binary data from one machine to
another. The two machines have a Modem (USB) and i want
to develop under VC++.
Please help
Sameer
|
|
|
|
|
If you can't use a floppy disk for some reason, set one modem to receive and use the other to send. You'll need some kind of communications software as well. You could also email the file from one machine to the other if both have access to email accounts. Without more info about your hardware, OS, size of binary data, etc., it is difficult to give a complete answer.
|
|
|
|
|
I need to sort some data in a flex grid and seem to be having some trouble. I have the Row/Column fixed data finished, but when I try placing data into the other fields it becomes all eratic as some data is left out and other data is repeated. If anyone would take a look at my code and give me an idea of what I am doing wrong I'd REALLY appreciate it. The work I am doing requires me to use the FlexGrid.
My code is listed below.
Thanks in advance,
Garry
void CFGridDlg::LoadData()
{
//Get the grid row count
int liCount;
//Initialize the random number generator
srand((unsigned)time(NULL));
//Create and array
for (liCount = m_ctlFGrid.GetFixedRows();
liCount < m_ctlFGrid.GetRows(); liCount++)
{
//Generate the first Column (Jan) values
//m_ctlFGrid.SetTextArray(GenID(liCount, 0), StringValue(1));
//Generate the second column (Jan) values
m_ctlFGrid.SetTextArray(GenID(liCount, 1), StringValue(1));
//Generate the third column (Feb) values
m_ctlFGrid.SetTextArray(GenID(liCount, 2), StringValue(1));
//Generate the fourth column (Mar) values
m_ctlFGrid.SetTextArray(GenID(liCount, 3), StringValue(1));
//Generate the fifth column (Apr) values
m_ctlFGrid.SetTextArray(GenID(liCount, 4), StringValue(1));
//Generate the sixth column (May) values
m_ctlFGrid.SetTextArray(GenID(liCount, 5), StringValue(1));
//Generate the seventh colummn (Jun) values
m_ctlFGrid.SetTextArray(GenID(liCount, 6), StringValue(1));
DoSort();
}
}
int CFGridDlg::GenID(int m_iRow, int m_iCol)
{
//Get number of columns
int liCols = m_ctlFGrid.GetCols();
//Generate ID's. based on number of Rows, the current row, and the current column
return (m_iCol + liCols * m_iRow);
}
CString CFGridDlg::StringValue(int m_iColumn)
{
//The return Str.
CString reStr;
//Random Value ID
int raCase;
//Set the selection to column 1
//m_ctlFGrid.SetCol(1);
{
//Generate random val.
raCase = (rand() % 5);
//What val was generated?
switch (raCase)
{
case 0: //Rent
reStr = "$650.00";
break;
case 1: //Insurance
reStr = "$259.00";
break;
case 2: //Utilities
reStr = "$130.00";
break;
case 3: //Car payment
reStr = "$220.00";
break;
case 4: //Loans
reStr = "$60.00";
break;
default: //Credit cards
reStr = "$30.00";
break;
}
}
return reStr;
}
void CFGridDlg::DoSort()
{
//Set the current column to column 1
m_ctlFGrid.SetCol(1);
//Set the selection to all columns
m_ctlFGrid.SetColSel((m_ctlFGrid.GetCols() - 1));
//Ascending sort
m_ctlFGrid.SetSort(0);
}
|
|
|
|
|
Hi,
I wonder how the internal CAsyncSocket message loop works?
Basically I understand that a asychronous network class regular checks sockets for changes and calls a corresponding notification handler. This is done in CAsyncSocket::DoCallBack() (file Sockcore.cpp). The first attached socket handle creates a CWnd (with window name "Socket Notification Sink"). With some message spying I found out WM_SOCKET_NOTIFY is regular send to this internal window and calls CAsyncSocket::DoCallBack() .
Unfortunately, the message routing isn't easy to understand (mixture of CAsyncSocket and CSocket). My questions:
How is the first WM_SOCKET_NOTIFY send?
Who keeps he notification loop alive (who and how often sends further WM_SOCKET_NOTIFY)?
Thx for help, Moak
|
|
|
|
|
How is the first WM_SOCKET_NOTIFY send?
By Winsock, i.e. by the system itself. Notification thru Windows messages is one of the mechanisms available (other is thru events.)
Who keeps he notification loop alive (who and how often sends further WM_SOCKET_NOTIFY)?
It is the message loop of your own app. These messages are handled just like say regular GUI messages. As for the frequency and sequence of notifications, have a look at WSAASyncSelect for further info.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thx for your explanation!
I took a look into MSDN and it sounds logical now.
|
|
|
|
|
GDay All,
I was hoping someone out there would be able to inform me
how to set overlay images using a CListCtrl and LVITEM or point
me in the direction of an existing tutorial etc.
//So far this is a summary of what i have
m_OverlayImageList.Create( 16,16,TRUE,8,1);
HICON hIcon;
hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ICON));
m_OverlayImageList.Add( hIcon );
m_ListSelected.SetImageList( &m_OverlayImageList, LVSIL_STATE );
//then after ive inserted my lvItem i try
LVITEM lvItem;
lvItem.mask = LVIF_STATE;
lvItem.state = LVIS_OVERLAYMASK;
lvItem.iImage = 1;
m_ListSelected.SetItem( &lvItem );
... ofcourse this doesnt work else i wouldnt be asking for help,
Any help will be much appreciated.
|
|
|
|
|
You're missing a few steps. Overlay images have to be specified as such in the image list before they can be used. Say you've got two icons in the image list, and you want to use the second one as the overlay:
m_ImageList.SetOverlayImage(1,1);
(image indexes are 0-based, so index 1 = the second image; overlay indexes are 1-based, so index 1 = the first overlay image)
Now you have an overlay defined, and you can set the icon to be drawn with the overlay:
lvItem.mask = LVIF_STATE|LVIF_IMAGE;
lvItem.iImage = 0;
lvItem.stateMask = LVIS_OVERLAYMASK;
lvItem.state = INDEXTOOVERLAYMASK(1);
That should do it!
--------
You can change the extention so it reads ASP even though it is PHP which is kind of cool. - Martin Marvinski --Shog9 --
|
|
|
|
|
Hi,
I want to develop a small application that receives calls and then according to some data received, does some processing and sends some data to the client.
Please provide some links
Sameer
|
|
|
|