milosev.com
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
      • Côte d'Azur 2024
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home

Microsoft Message Queuing

Details
Written by: Stanko Milosev
Category: MSMQ
Published: 09 December 2008
Last Updated: 10 December 2009
Hits: 8082

First of all you have to install MSMQ. You will do it through Control panel->Add remove programs->Add/Remove Windows components.

Second you will need to access MSMQ for managing, you can do it through Computer Management->Services and Applications->Message Queuing

Now, create one queue, for example "test", under Private Queues.

Then, send a message through Delphi :)

Here is the code:

For sending messages:

procedure TForm3.Button1Click(Sender: TObject);
var
  queuename, subject: string;
  data: olevariant;
  queueinfo, QueueInfosObj: IMSMQQueueInfo;
  queue, QueryObj: IMSMQQueue;
  msg: IMSMQMessage;
  tr: OLEVariant;
begin
{ STANKO is name of my computer, test is name of queue}
  queuename := 'Direct=OS:STANKOprivate$ est';
  subject := Edit1.text;
  data := Memo1.text;

  try
    queueinfo := CreateCOMObject (CLASS_MSMQQueueInfo) as IMSMQQueueInfo;
    queueinfo.FormatName := queuename;
    queue := queueinfo.Open (MQ_SEND_ACCESS, MQ_DENY_NONE);
    if queue.IsOpen 1 then
      statusbar1.Panels[0].Text := 'I can not get access to queue!'
   else
begin
  try
  msg := CreateCOMObject (CLASS_MSMQMessage) as IMSMQMessage;
  msg.label_ := subject;
  msg.body := data;
  tr := MQ_NO_TRANSACTION;
  msg.Send (queue, tr);
  statusbar1.Panels[0].Text := 'Sent!'
finally
  queue.close;
end;
  end;
  except
  on e: exception do showmessage (e.message);
  end;
end;

Now, for receiving messages:

procedure TForm3.Button2Click(Sender: TObject);
var
queuename: string;
data: olevariant;
queueinfo: IMSMQQueueInfo;
queue: IMSMQQueue;
msg: IMSMQMessage;
tr, wdq, wb, rt: OLEVariant;
begin
queuename:= 'Direct=OS:STANKOprivate$ est';
try
  queueinfo := CreateCOMObject (CLASS_MSMQQueueInfo) as IMSMQQueueInfo;
  queueinfo.FormatName := queuename;
  queue := queueinfo.Open (MQ_RECEIVE_ACCESS, MQ_DENY_NONE);
  if queue.IsOpen 1 then
  statusbar1.Panels[0].Text := 'I can not get access to queue!'
  else
  begin
  try
  tr := MQ_SINGLE_MESSAGE;
  wdq := False;
  wb := True;
  rt := 1000;
  msg := queue.Receive (tr, wdq, wb, rt);
  if msg nil then
  begin
  data := msg.body;
  statusbar1.Panels[0].Text := 'Received!';
  memo2.text:=data;
  edit2.text:=msg.label_;
  end
  else
  statusbar1.Panels[0].Text := 'No messages'
  finally
  queue.close;
  end;
  end;
except
  on e: exception do showmessage (e.message);
end;
end;

Code taken from here. It is on Slovenian, but I coudn't find it on English.

Here you can download source code created in D2007, and here is the exe file.

ORA-00904: invalid identifier

Details
Written by: Stanko Milosev
Category: Oracle
Published: 18 March 2009
Last Updated: 30 November -0001
Hits: 8566
If you ever received this error then try to write field names in the Oracle with upper case, or use quotas.

ora-01036 illegal variable name/number

Details
Written by: Stanko Milosev
Category: Oracle
Published: 04 March 2009
Last Updated: 30 November -0001
Hits: 6302
Error: ora-01036 illegal variable name/number will happen if you added parameter in Param of TSQLQuery and there is no parameter in the SQL (there is no anything as :Parameter)

Warning: date()

Details
Written by: Stanko Milosev
Category: PHP
Published: 22 September 2010
Last Updated: 30 November -0001
Hits: 6115

If you are receiving error like:

Warning: date(): It is not safe to rely on the system's timezone settings.

In PHP 5.3.x

Fastest fix is to add something like:

date.timezone = "Europe/Ljubljana"

in your php.ini.

  1. Data source name not found and no default driver specified
  2. The specified module could not be found.
  3. Instalation on IIS 5.1 (WinXp)
  4. Save XML in human readable format

Subcategories

C#

Azure

ASP.NET

JavaScript

Software Development Philosophy

MS SQL

IBM WebSphere MQ

MySQL

Joomla

Delphi

PHP

Windows

Life

Lazarus

Downloads

Android

CSS

Chrome

HTML

Linux

Eclipse

Page 101 of 164

  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105