473,731 Members | 2,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PostMessage() error


PostMessage() function returns ERROR_NOT_ENOUG H_QUOTA after running in a
loop for 700 times, but the disk space and memory are still big enough.

any suggestion to resolve this problem?
thanks.
Dec 4 '06 #1
21 6891
>PostMessage( ) function returns ERROR_NOT_ENOUG H_QUOTA after running in a
>loop for 700 times, but the disk space and memory are still big enough.
That sounds like a safety limit to prevent excessive numbers of
messages. In normal circumstances it would seem to indicate that
you're trying to post messages to a window that's not processing
messages.
>any suggestion to resolve this problem?
Don't do it.
Allow the other application to run and process its messages.

Dave
Dec 4 '06 #2


On 4 déc, 08:56, "one2001...@yah oo.com" <one2001...@yah oo.comwrote:
PostMessage() function returns ERROR_NOT_ENOUG H_QUOTA after running in a
loop for 700 times, but the disk space and memory are still big enough.

any suggestion to resolve this problem?
thanks.
Why are you trying this measurement? What are you trying to do?
Windows GUI messages are aimed at GUI/window interacting. Usually,
hitting those limits means you are subverting the GUI messaging system
to do something else, something it wasn't designed for.

Eg, I have seen acquistion loops or the like using PostMessage. Don't
do it!

Arnaud
MVP - VC

Dec 4 '06 #3
David Lowndes wrote:
>>PostMessage () function returns ERROR_NOT_ENOUG H_QUOTA after running in a
loop for 700 times, but the disk space and memory are still big enough.


That sounds like a safety limit to prevent excessive numbers of
messages. In normal circumstances it would seem to indicate that
you're trying to post messages to a window that's not processing
messages.
here is the sample code. I removed createprocess() function.
>
int main()
{
....
while (fgets(psBuffer , BUFFER_SIZE, stdin) != NULL) {
PostString(hwnd Text, psBuffer);
}
....}
void
PostString(HWND hwnd, char *pc)
{
while(*pc) {
PostMessage(hwn d, WM_CHAR, (unsigned char) *pc, 1L);
pc++;
}
}

it get the problem of ERROR_NOT_ENOUG H_QUOTA for the function of
PostMessage() after processing 4k of stdin piped data ( I have 14K of
stdin data to process)

do you think 14k of stdio piped data is too big for PostMessage()?

thanks.
Dec 5 '06 #4
ad******@club-internet.fr wrote:
>
On 4 déc, 08:56, "one2001...@yah oo.com" <one2001...@yah oo.comwrote:
>>PostMessage () function returns ERROR_NOT_ENOUG H_QUOTA after running in a
loop for 700 times, but the disk space and memory are still big enough.

any suggestion to resolve this problem?
thanks.


Why are you trying this measurement? What are you trying to do?
Windows GUI messages are aimed at GUI/window interacting. Usually,
hitting those limits means you are subverting the GUI messaging system
to do something else, something it wasn't designed for.

Eg, I have seen acquistion loops or the like using PostMessage. Don't
do it!
See my answer to David. Thanks.
Dec 5 '06 #5
<on********@yah oo.comwrote in message
news:eg******** ******@TK2MSFTN GP04.phx.gbl...
it get the problem of ERROR_NOT_ENOUG H_QUOTA for the function of
PostMessage() after processing 4k of stdin piped data ( I have 14K of
stdin data to process)

do you think 14k of stdio piped data is too big for PostMessage()?
The issue is not so much about PostMessage() as it is about the queue of
messages in the target application. The function deposits a message in the
queue and returns. If you have a big buffer, on a fast machine, what's
happening is that your application is posting messages for the whole of its
timeslice while the receiver has no chance to drain the queue.

You need to switch to a better method of IPC - perhaps SendInput() as I
suggested in another thread - or you need to block the sender periodically -
perhaps with WaitForInputIdl e() specifying the receiver's process handle.

Regards,
Will

Dec 5 '06 #6
William DePalo [MVP VC++] wrote:
<on********@yah oo.comwrote in message
news:eg******** ******@TK2MSFTN GP04.phx.gbl...
>>it get the problem of ERROR_NOT_ENOUG H_QUOTA for the function of
PostMessage () after processing 4k of stdin piped data ( I have 14K of
stdin data to process)

do you think 14k of stdio piped data is too big for PostMessage()?


The issue is not so much about PostMessage() as it is about the queue of
messages in the target application. The function deposits a message in the
queue and returns. If you have a big buffer, on a fast machine, what's
happening is that your application is posting messages for the whole of its
timeslice while the receiver has no chance to drain the queue.

You need to switch to a better method of IPC - perhaps SendInput() as I
suggested in another thread - or you need to block the sender periodically -
perhaps with WaitForInputIdl e() specifying the receiver's process handle.

Regards,
Will
the pipe is for a file not for keyboard typed characters,
it runs such as
executable.exe < piped_file
or use fopen() to open the file and send to windows GUI appications

SendInput() might not be suitable for my case.

thanks.
Dec 5 '06 #7
<on********@yah oo.comwrote in message
news:eZ******** ******@TK2MSFTN GP05.phx.gbl...
the pipe is for a file not for keyboard typed characters,
Then why are you sending WM_CHAR messages? Those messages are in general
synthesized by Windows when it encounters WM_KEYUP and WM_KEYDOWN messages
in the queue and those are generated in response to user keystrokes.
SendInput() might not be suitable for my case.
I don't know what you are trying to do, but SendInput() was practically
invented so that you don't have to send WM_CHAR messages which is a bad
idea. You have to understand that the WM_CHAR messages are intended to be
used for input to controls like edit boxes in cases where the user is typing
away at the keyboard.

What I suspect you are doing is well beyond the pale in that it looks like
you are stuffing several KB of keystrokes into what might be called "type
ahead buffer" on another platform.

Regards,
Will
Dec 5 '06 #8
William DePalo [MVP VC++] wrote:
<on********@yah oo.comwrote in message
news:eZ******** ******@TK2MSFTN GP05.phx.gbl...
>>the pipe is for a file not for keyboard typed characters,


Then why are you sending WM_CHAR messages? Those messages are in general
synthesized by Windows when it encounters WM_KEYUP and WM_KEYDOWN messages
in the queue and those are generated in response to user keystrokes.
I think the original author wants to be able to use keyboard input as
well. but for my use, I will use it to read from a file to redirect to
a windows GUI application.

I just read the link from
http://msdn.microsoft.com/library/de...ostmessage.asp

it looks that I only need to modify the registry value for windows
2000/XP for

HKEY_LOCAL_MACH INE->SOFTWARE->Microsoft->Windows
NT->CurrentVersi on->Windows->USERPostMessag eLimit

HOwever, there is no such a registry value under windows XP,

I modified

HKEY_LOCAL_MACH INE->SOFTWARE->Microsoft->Windows
NT->CurrentVersi on->Windows->USERProcessHan dleQuota ,
increase it from 10000 to 30000. it doesn't seem to work.

Then, I add the registry value for USERPostMessage Limit as requested,
run the program again, it still has the same problem.

If I change the PostMessage() function to SendInput(), do I need to
modify windows GUI applications to recieve the data?

thanks.
Dec 5 '06 #9
<on********@yah oo.comwrote in message
news:ez******** ******@TK2MSFTN GP06.phx.gbl...
William DePalo [MVP VC++] wrote:
><on********@ya hoo.comwrote in message
news:eZ******* *******@TK2MSFT NGP05.phx.gbl.. .
>>>the pipe is for a file not for keyboard typed characters,
First, I have no idea what it your application is doing, but second WM_CHAR
is a message which most definitely has to do with characters typed by a
user. There are times when applications create these messages in a hokey way
to simulate a user at a keyboard but you should not expect this to work
reliably. For that SendInput() is usually a better choice.

What class of window is the one to which you are sending the WM_CHAR
messages?
it looks that I only need to modify the registry value for windows
2000/XP for

HKEY_LOCAL_MACH INE->SOFTWARE->Microsoft->Windows
NT->CurrentVersi on->Windows->USERPostMessag eLimit

HOwever, there is no such a registry value under windows XP,

I modified

HKEY_LOCAL_MACH INE->SOFTWARE->Microsoft->Windows
NT->CurrentVersi on->Windows->USERProcessHan dleQuota ,
increase it from 10000 to 30000. it doesn't seem to work.
OMG. I tried to explain in a previous message why I thought you were having
a problem and what you needed to do. As I see it, nothing good will come of
hacking the registry.

Regards,
Will
Dec 5 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1868
by: Paul | last post by:
Hi all. Probably a quick one, I'm using PostMessage to send keys to an applicatoin but how do I convert the key string to a long values so that I can pass this to the wParam. The definition is below Private Declare Auto Function PostMessage Lib "user32" ( _ ByVal hWnd As IntPtr, _ ByVal Msg As Integer, _ ByVal wParam As Long, _
15
8450
by: James | last post by:
In my code I have a problem in abtaining a windows handle. I do not know the namespace to obtain the windows hanle. here is the code. using System; using System.Collections; using System.Windows.Forms; using System.Runtime.InteropServices; namespace mynamespace
12
7197
by: Wilfried Mestdagh | last post by:
Hi, Using P/Invoke I use PostMessage to send a message from one thread to another. I'm pretty sure this has already worked in dotnet. but I've upgraded version 2 few day ago. Now I have an illegal cross thread operation if posting a message. Is this a bug introduced in latest version of dotnet ? It is very legal to use postmessage because the message will execute in context of the thread the one was posted to. Same with...
2
2620
by: Lenster | last post by:
When using PostMessage to post myself a message, the msg and wparam parameters somehow get swapped over. They are in the correct order when calling PostMessage but by the time wndproc handles the message msg is now in the wparam position and msg is set to 0 (NULL message). Does anyone know why this behaviour is occurring ? I've included a simple test form below to illustrate this...
3
5094
by: Max M. Power | last post by:
When I use the SendMessage API I can sucessfully send and receive a user defined message. When I use the PostMessage API I can NOT sucessfully send and receive the same user defined message. I've got a C# class library project with two classes: Class 1 is derives from : System.Windows.Forms.Form and overrides the base WndProc method for the purpose of receiving and handeling user defined messages:
11
9170
by: seattleboatguy | last post by:
I am trying to send a message from a visual c++ user-thread to the main window, so the main window can update text on the window to reflect what the user-thread is doing. I have tried 2 different approaches, and both fail. I don't know what to try next. +++++++++++++++++++++++++++++++++++++++++++++++++++++ APPROACH #1: (this approach makes the most sence to me) Configure the first parameter of the thread's PostMessage() to talk to the...
3
5627
by: easoftware | last post by:
In my ComboBox, I am trying to post the CBN_EDITCHANGE message after the CBN_SELCHANGE is received, but I am having no luck. I can trap for the CBN_SELCHANGE message, but I cannot post the CBN_EDITCHANGE message. I think my PostMessage parameters are wrong, but I cannot find what they should be. Any help would be greatly appreciated. Thanks. Here is my code.
3
9466
by: knikkix | last post by:
Hi, I created a form in VB.Net with only one button. This is the code in button click event Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click AppGlobals.SetHandles(Me.Handle.ToInt64()) Call OpenModel() End Sub
10
2584
by: Sergei | last post by:
Can anyone explain why PostMessage to a Windows Form is considered unsafe and raises InvalidOperationException? I can get rid of that setting CheckForIllegalCrossThreadCalls to false and everything works just fine. Still I feel somewhat uncomfortable. Sergei
0
8943
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9442
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9229
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8184
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6725
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4543
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4801
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.