Link to home
Start Free TrialLog in
Avatar of daskino12
daskino12

asked on

How do you make a link(URL) which users can click in a message in WinCE?

Hello,

I am having trouble making a link which users can click on a message (like pop-up or notifyer). For example, I have just made a little problem which after a certain minutes, there is a message saying "time's up".  I would like to make a link so that when that little message pops up, I can click on it so the link(URL) so a IE will be opened and go to that link.

Thanks
Avatar of Mikal613
Mikal613
Flag of United States of America image

what Os ce? what Programming platform?
Avatar of daskino12
daskino12

ASKER

Hello,

OS is WinCE and using C++.

Thanks
what version of ce 3.0? 4.2?  evc?? c++.net??
well the best way is to make a label with whatever you want and on the click you call a shellexecute

http://www.opennetcf.org/Forums/topic.asp?TOPIC_ID=263
Hello,  

I am using EVC and it's WinCE 3.0.

Thanks
Hello,

I am sorry but I am not sure if i follow the stuff on the links given above.  Here is my code (partially):
------------------------------------------------------------------------------------------------------------------------
BOOL CALLBACK GetValDlgProc (HWND hWnd, UINT wMsg, WPARAM wParam,
                                           LPARAM lParam) {
      TCHAR szText[64];

      switch(wMsg) {
      case WM_INITDIALOG:
            SHSipPreference(hWnd, SIP_UP);
            SetDlgItemInt (hWnd, IDD_VALUE, 0, TRUE);
            SendDlgItemMessageW (hWnd, IDD_VALUE, EM_LIMITTEXT,
                                  sizeof(szText)-1, 0);
            return TRUE;
   
      case WM_COMMAND:
            switch (LOWORD (wParam)) {
          case IDOK:
                // Get text from edit control.
                  GetDlgItemTextW (hWnd, IDD_VALUE, szText, sizeof(szText));
                if((iUpdateTime = atoi((char *)szText)) != 0)
                  {
                      // initialize dalp object
                        DalpMysql dalpone;
   
                Dint nRetu = 0;
                nRetu = dalpone.dalp_connect("");
                if (0 != nRetu)
                        {
                          AfxMessageBox(__T("Did not connect"));
                  Dchar* pszErrorMessage = (Dchar*) new Dchar[1024];
                  memset(pszErrorMessage, 0x00, 1024);
                  // call function
                  dalpone.dalp_get_last_error(nRetu, pszErrorMessage);
                  // display the error string
                  AfxMessageBox(CString(pszErrorMessage));
                  // Now we have to delete this pszErrorMessage since it
                  // is returned as a OUT parameter.
                  delete pszErrorMessage;
                        }
                else
                        {
                           AfxMessageBox(__T("Connected successfully"));
-------------------------------------------------------------------------------------------------------------------
At the very buttom, this line,  "AfxMessageBox(__T("Connected successfully"));" is a pop up message saying "Connected succcessfully" and then I would like to add this one " AfxMessageBox(__T("Please go to http://www.xxx.com"));" and an user can click on the link which will open an Internet Explorer with that URL.  I am currently using EVC++ as you can see.

Any help will be much appreciated.  

Thanks
you cannot do that in a messagebox you would have to make your own home made form with a label to do that
Hello,

So, after that "AfxMessageBox", I can just create a home-made form with a label by using shellexecute you mentioned above?

Thanks


Hello,

Both links from "https://www.experts-exchange.com/questions/20145674/Lauch-pocket-word-document-from-pocket-visual-basic.html" are dead and the working codes is for VB.

Do you have any other references that might be helpful?

Thanks
Hello,

I am sorry but I am really a newbie on this.  The OS is Pocket PC and it's compatible with WinCE 3.0, right?

Thanks
Hello,

I keep getting "Page Cannot Be Found" on the above links.

Also, I can use so called " lnCreateProcess" you mentioned to do it, right?

So, it will be like:

Option Explicit
Public Declare Function CreateProcess Lib "coredll" Alias "CreateProcessW" ( _
    ByVal pszImageName As String, _
    ByVal pszCmdLine As String, _
    ByVal psaProcess As Long, _
    ByVal psaThread As Long, _
    ByVal fInheritHandles As Long, _
    ByVal fdwCreate As Long, _
    ByVal pvEnvironment As Long, _
    ByVal pszCurDir As Long, _
    ByVal psiStartInfo As Long, _
    ByVal pProcInfo As Long) As Long

Private Sub Command1_Click()
    Dim lnCreateProcess As Long
    Dim strFileName As String
    strFileName = "\My Documents\DocName.psw"
    On Error Resume Next
    lnCreateProcess = CreateProcess("\Windows\pword.exe", strFileName, 0, 0, 0, 0, 0, 0, 0, 0)
    If lnCreateProcess = 0 Then
        MsgBox Err.Description
    End If
End Sub

but I just have to delete strFileName part and in "InCreateProcess" i will just need to put a link instead of a path, right?

Thanks
thats right

It sounds like you dont have internet conn.
Hello,

I am sorry but what do you mean "it sounds like you don't have a internet connection"?

Thanks
Helllo,

I have tried to compile it and i got the following errors:

error C2065: 'Option' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'Explicit'
error C2065: 'Explicit' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'Public'
error C2065: 'Public' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'Declare'
error C2065: 'Declare' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'Function'
error C2065: 'Function' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'CreateProcessW'
error C2146: syntax error : missing ';' before identifier 'Lib'
warning C4551: function call missing argument list
error C2065: 'Lib' : undeclared identifier
error C2143: syntax error : missing ';' before 'string'
error C2146: syntax error : missing ';' before identifier 'Alias'
error C2065: 'Alias' : undeclared identifier
error C2143: syntax error : missing ';' before 'string'
error C2065: '_' : undeclared identifier
error C2146: syntax error : missing ')' before identifier 'ByVal'
error C2059: syntax error : ')'
error C2065: 'nRetTwo' : undeclared identifier

Do you know why?

Thanks
are you sure you have an Internet connection when you go to the links i posted above?

The errors above means you used the VB code when you are using c++

USe this function

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcekernl/html/_wcesdk_Win32_CreateProcess.asp

if that doesnt work you can try this

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceactsy/html/cerefCeCreateProcessRAPI.asp

You will give the path of Pocket Internet explorer and as the command line you put that WEB Address.
Hello,

Thank you.  The links are working now.  Do you happen to have any code examples by how to using CreateProcess in C++?

Thanks

here is a tutorial im looking for an example
http://www.cs.rpi.edu/courses/fall01/os/CreateProcess.html
not specifically but youll seee code how to use the Function

http://www.rootkit.com/board.php?did=edge96&closed=0&lastx=15
Hello,

I am sorry but do you happen to know the path of internet explorer in pocket pc?

Thanks
Hello,

Here is my code for CreateProcess:

         char strFileName = ("http:\\www.hotmail.com");
         CreateProcess("windows\pword.exe", strFileName, 0, 0, 0, 0, 0, 0, 0, 0);

Since i do'nt know the path of Internet explorer, i will just use the Word application to test it out.  However, I got some errors:

warning C4129: 'p' : unrecognized character escape sequence
error C2664: 'CreateProcessW' : cannot convert parameter 1 from 'char [17]' to 'const unsigned short *'

Any suggestions?

Thanks
int WINAPI CallShell(LPCTSTR lpFilePath, LPCTSTR lpURL)
{
      SHELLEXECUTEINFO *lpSHInfo;
      BOOL RetVal;
      
      lpSHInfo = (SHELLEXECUTEINFO *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SHELLEXECUTEINFO));
      lpSHInfo->cbSize = sizeof(SHELLEXECUTEINFO);
      lpSHInfo->fMask = SEE_MASK_NOCLOSEPROCESS;
      lpSHInfo->lpFile = lpFilePath;
      lpSHInfo->lpParameters = lpURL;

      RetVal =  ShellExecuteEx(lpSHInfo);

      HeapFree(GetProcessHeap(), 0, lpSHInfo);
      return RetVal;
}



   
  call like this
    RetVal = CallShell("\windows\iexplore.exe", "www.google.com")
Hello,

Thanks a lot for helping.  However, i am still getting errors:

error C2065: 'RetVal' : undeclared identifier
 warning C4129: 'w' : unrecognized character escape sequence
warning C4129: 'i' : unrecognized character escape sequence
error C2664: 'CallShell' : cannot convert parameter 1 from 'char [20]' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
error C2144: syntax error : missing ';' before type 'int'

I think it's pretty much the same errors i got...

Thanks
Hello,

Acutally, I add BOOL when i call ReVal function like this: "BOOL RetVal = CallShell("\windows\iexplore.exe", "www.google.com");" so I don't have this error "error C2065: 'RetVal' : undeclared identifier" anymore (which i wonder why I have to add "BOOL" again since RetVal was declared).

But i am still getting this errors:


warning C4129: 'w' : unrecognized character escape sequence
warning C4129: 'i' : unrecognized character escape sequence
error C2664: 'CallShell' : cannot convert parameter 1 from 'char [20]' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Thanks
Hello,

I just solved the warning errors.  It seems we need double slash rather than just one.  However, I am still getting the same error:

error C2664: 'CallShell' : cannot convert parameter 1 from 'char [20]' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Any help will be appreicated.

Thanks
Hello,

Any help?  Thanks
Working on it now...


>>error C2664: 'CallShell' : cannot convert parameter 1 from 'char [20]' to 'const unsigned short *'

It seems your project is set to compile as UNICODE - use the '_T()' macro to take care of that and double the backslashes:

BOOL RetVal = CallShell( _T("\\windows\\iexplore.exe"), _T("www.google.com"));

If that doesnt work then try this:

ShellExecute ( NULL, _T("open"), _T("www.google.com"), NULL, NULL, SW_SHOW);


try this also

BOOL RetVal = CallShell( _T("\windows\\iexplore.exe"), _T("www.google.com"));
or
BOOL RetVal = CallShell((LPCTSTR) "\windows\\iexplore.exe", (LPCTSTR) "www.google.com");
or
BOOL RetVal = CallShell(reinterpret_cast<LPCTSTR>("\windows\\iexplore.exe"), ...);
ASKER CERTIFIED SOLUTION
Avatar of Mikal613
Mikal613
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello,

IT WORKED!! May I ask why I need to add _T?  Also, what does the error, error C2664: 'CallShell' : cannot convert parameter 1 from 'char [20]' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

mean?

Thanks
Hello,

I am sorry but I was just wondering, is it possible for me to make it so the internet explorer pops up only if when I click the link?

Thanks
a)you had to convert the type
b)yeah add the code on the Click of the Label which happens to be your link.
Hello,

What type is "_T"?

Add the code on the click of the label?

THanks

'Create a label and on the ClickEvent of the label you do your code
Hello,

I am sorry but do you have more links(or tutorials) on ClickEvent?

Also, i was wondering, is it possible for me to pre-enter username and password when I go to a certain website that requires username and passowrd?

Like, when I click a link, it will direct me to another page with username and password blanks which will need to be entered in order to access the website.  Can I pre-enter those info?

Should I make this questions as new ones?

Thanks
that would be nice to make a new question
anyways there is no click event you would have to make your own or a hack possibilly is to use the

DragDrop event
if that fails you can use a button
Hello,

I think i got it.  However, I will still need help on that pre-enter user/pass thing.  I will open a new questions.

THANK YOU SO MUCH!!

Thanks