Sending WinPopup messages

I wont to send winpopup messages from my Java application. I'm working on Win98 so i can't use net send as I could using WindowsNT!
Who is Participating?
msterjevConnect With a Mentor Commented:
JNI solution:

The Java class:

public class WinPopup
     protected String from;
     public WinPopup(String from)
     public boolean sendMessage(String computer,String to,String message)
          return sendMessage(computer,from,to,message);
     public native boolean sendMessage(String computer,String from,String to,String message);

Generate the header file:

javah WinPopup

Generate new dll project and add WinPopup.h into the project.
Add new C++ file and paste this:

#include <windows.h>
#include "WinPopup.h"

JNIEXPORT jboolean JNICALL Java_WinPopup_sendMessage(JNIEnv * env, jobject obj, jstring c, jstring f,jstring t, jstring m)
     BOOL success=false;
     DWORD msgLength;
     DWORD bytesWritten;

     const char * computer=env->GetStringUTFChars(c,0);
     const char * from=env->GetStringUTFChars(f,0);
     const char * to=env->GetStringUTFChars(t,0);
     const char * message=env->GetStringUTFChars(m,0);
     //Prepearing WinPopup message

     char * winPopMsg=new char[msgLength];

     //Prepearing Mailslot

     char mailslot[256];

     //Opening Mailslot
     HANDLE fileHandle=CreateFile(mailslot,GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);


     delete winPopMsg;

          return JNI_TRUE;
          return JNI_FALSE;

Put the generate dll into the same directory as WinPopup class.
Test it with:


public class Test
     public static void main(String[] args)throws Exception
          WinPopup wp=new WinPopup("Myself");
          String comp="Comp1";
          String to="Someone";
          String line;
          DataInputStream in=new DataInputStream(;

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.