|
Replace MQC.MQGMO_BROWSE_FIRST with MQC.MQGMO_BROWSE_NEXT and call Get in a loop until it fails - it will throw a harmless exception with a reason code of MQRC_NO_MSG_AVAILABLE when there are no more messages to browse.
I would also suggest that you use MQGMO_NO_WAIT rather than MQGMO_WAIT so that you don't have to wait until a message appears on the queue when you browse an empty queue.
Example code using home-brewed helper methods:
public bool browseMessages(out ArrayList messages, string queue)
{
messages = new ArrayList();
MQQueueManager mqQM = null;
MQQueue mqQ = null;
try
{
if (queue == null || queue.Length == 0)
throw new Exception("Queue name required");
connectManager(out mqQM);
connectQueue(mqQM, queue, MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_BROWSE, out mqQ);
MQGetMessageOptions mqGMO = new MQGetMessageOptions();
mqGMO.Options = MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_NO_WAIT + MQC.MQGMO_BROWSE_NEXT;
mqGMO.MatchOptions = MQC.MQMO_NONE;
MQMessage mqMsg = new MQMessage();
while (true)
{
mqQ.Get(mqMsg, mqGMO);
messages.Add(mqMsg.ReadString(mqMsg.MessageLength));
}
}
catch (MQException mqex)
{
if (mqex.ReasonCode == MQC.MQRC_NO_MSG_AVAILABLE)
{
return true;
}
else
throwMQException(mqex);
}
finally
{
if (mqQ != null)
mqQ.Close();
if (mqQM != null)
mqQM.Disconnect();
}
return false;
}
Gavin
|
|
|
|
|
Hi,
I am working on context menus using IContextMenu interface in COM, have just created a .net wrapper and added some context menus, can any body help me regarding addition of a seperator above and below the menu items in windows...
Thanks in advance,
Regards.
|
|
|
|
|
hi,
i have read in some article regarding onlayout method of the controls,that takes some event argument ......bla... bla
what is the use of onlayout method? and when it should be called ?and how it should be called?
|
|
|
|
|
Hi..
I use C#.NET..
I pass 4 - 5 command line arguments to my appln.
for eg:
/c:class /d:define /o:outputfile Infile
for the first 3 arguments i can find them based on delimiters("/c:" "/d:" "/o:")
But how can i find the last argument(also it can be anywhere in the command line arguments )
One thing is sure the "InFile" argument will not have any delimiters.
Plz provide me the code to do this..Plz Help!!!
|
|
|
|
|
The space is always a delimiter, unless it's in quotes. So, you can build a regex to delimit based on spaces outside quotes.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am not able to do with that..Is there any other possible way???
|
|
|
|
|
Why can't you ?
There's no other way I can see, unless you're sure there will never be quotes, then the space is a delimiter.
If you're unwilling to use a regex ( and if you don't know how, you should learn ), then you can always string mash your way to a solution, it's just nicer to do it properly.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
it will definetly have quotes bcoz its the input file name i should pass..
So it will definetly have quotes..say eg: "d:\c plus\some.h"..so this string should always be specified in quotes..
|
|
|
|
|
OK, then your choices are regex or string mashing ( that is, counting spaces and quotes manually in code )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
I try to import a simple text file that have many rows with a special row format
Example: |item|123|any items|4.50|
When I read the lines in from the text file it removes the '|' tag.
Why is that??
Example Code:
StreamReader importFile = File.OpenText(txtPath.Text);
txtLines.Text = txtLines.Text + importFile.ReadLine();
I know I'm missing something simple.
Thanks for any help.
|
|
|
|
|
Perhaps | is a delimiter for the stream reader ? Is it reading the whole line every time, or up to the | ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I'm reading a whole line into a temp string and use the '|' tag to divide the string into column values.
When I read the whole string from the file the '|' tag is missing. So, I cannot divide the string up.
thanx
|
|
|
|
|
Hi all I am trying to convert code that being written in C++ to C# and I found that structure that using a property in C++ called "Bit Fields" and I didn't found it in C#, is there any way to convert it to C#
thx all
typedef struct _tagCPB {
unsigned short DialMode :1;
unsigned short LineToPBX :1;
unsigned short TriggerMode :1;
unsigned short DetectRoaringRemoteHangUp :1;
unsigned short DetectBusyRemoteHangUp :1;
unsigned short DetectRemoteHangUpWhenRecording :1;
unsigned short DetectRemoteHangUpAlways :1;
unsigned short StopOperationRemoteHangUp :1;
unsigned short MonitorDTMF :1;
unsigned short MonitorEnergy :1;
unsigned short DetectVoltReverseRemoteHangUp :1;
unsigned short DetectSilentWhenRecording :1;
unsigned short LearnPulse :1;
unsigned short MonitorPulse :1;
unsigned short MonitorTone :1;
unsigned short :1;
unsigned short OffHookDelay;
unsigned short OnHookDelay;
unsigned short FlashTime;
unsigned short PulseMake;
unsigned short PulseBreak;
unsigned short PulsePostDigitPause;
unsigned short ToneDuration;
unsigned short InterTonePause;
unsigned char OutsideLineAccess;
unsigned char RingsToAnswer;
unsigned short WaitAnswerDuration;
unsigned short InterDigitPause;
unsigned short NoSignalTimeOut;
unsigned short MaxSilence;
unsigned short MaxRoarDuration;
char PlayGain;
char RecordGain;
unsigned char PlayMode;
unsigned char RecordMode;
unsigned char OffThreshold;
} typeCPB;
|
|
|
|
|
|
Hi,
I am trying to fill a datatable with data for all records that have not been actioned. When they have been actioned a date is entered into the "actioned" field. Until it has been actioned, the field is empty.
How do I pass an empty/isNull parameter in the following:
this.correspondenceTableAdapter.FillBy(myclubDataSet.Correspondence, XXX );
where the XXX represents an empty DateTime field in the database.
Glen Harvy
|
|
|
|
|
DBNull.Value ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks for the prompt response but ..
this.correspondenceTableAdapter.FillBy(myclubDataSet.Correspondence, DBNull.Value);
results in:
Error16 Argument '2': cannot convert from 'System.DBNull' to 'System.DateTime?'
Glen Harvy
|
|
|
|
|
OK, you're using table adapters. I don't think there's such a thing as an empty DateTime, it has to have a value, and so you'd need to have your database table accept nulls for this column, in order to store a meaningful 'empty' date time value.
There is no such thing as DateTime.Empty.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I fixed it by amending the Select command in the tableadapter itself so that no parameter is passed at all.
Glen Harvy
|
|
|
|
|
Hi all
I am new to Visual Studio 2005 Windows Mobile development, please bear with me for some questions.
I have exe file installed in the device.
1.The Application launching very slow.When I double click the exe. file, I need to register to SIP Server,then load the Login form.its taking 4 to 5 sec for loading login-form.
2.Right now Iam connecting to internet thru GPRS before I launch the application.Is there any way to connect to internet on clicking Login -button?
3.I am trying to Exit the application many ways, but its not closing ,still running at the back-ground.
Please help me.
regards
|
|
|
|
|
We need to dynamically fetch text from the PNG files using C#.NET code. The application would load the image in memory and extract(return) the text out of it. We are aware that it is png specific ocr process. But I am unable to find a solution for it. The other requirement is that the solution for the above mentioned problem should not use any executables. Instead if it uses any COM dll, then the problem is rectified.
Thanks in advance,
Rgds
Amit
|
|
|
|
|
Is the text stored in metadata associated with the image, or in the actual image itself ? That is, can you see the text when you view the image ? If so, this is a pretty big task
Jatin Kakkar wrote: The other requirement is that the solution for the above mentioned problem should not use any executables. Instead if it uses any COM dll, then the problem is rectified.
So you're basically looking for an OCR library ? I believe Atalasoft has one for sale.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks Christian for a prompt reply. I am looking for some free source code(downloadable) for achieving the same. Buying a tool will take a lot more time to be approved. Any help in this direction will be highly appreciated.
|
|
|
|
|
OCR is never perfect. According to the google page someone linked you to:
It also doesn't do well on grayscale and color documents, and it's not nearly as accurate as some of the best commercial OCR packages out there. Yet, as far as we know, despite its shortcomings, Tesseract is far more accurate than any other Open Source OCR package out there
I take that to mean - good luck. If you need to use something free, then this is your best bet, perhaps you can turn the images to 1 bit first ? Anyhow, realistically, if you want any sort of guarentee, or any sort of support, you need to buy a library. You certainly don't want to be writing one.
Also, be aware that OCR performs very poorly when the text is not lined up exactly, or has background noise.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks again... As correctly mentioned by you that OCR-ing is not a perfect way of achieving the above mentioned task. Is there any other way out to extract the text from the PNG files. Buying a library seems to be the last resort for ur as the approval wfor the same would take a long time.
|
|
|
|