Solved

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

Posted on 2004-04-16
43
540 Views
Last Modified: 2013-12-27
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
0
Comment
Question by:daskino12
  • 22
  • 21
43 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 10851234
what Os ce? what Programming platform?
0
 

Author Comment

by:daskino12
ID: 10851475
Hello,

OS is WinCE and using C++.

Thanks
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10851631
what version of ce 3.0? 4.2?  evc?? c++.net??
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10851911
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
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10851922
0
 

Author Comment

by:daskino12
ID: 10852009
Hello,  

I am using EVC and it's WinCE 3.0.

Thanks
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10852031
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10852049
read the posts and just write the link instead of the path to app
http://www.experts-exchange.com/Programming/Wireless_Programming/WinCE/Q_20145674.html
0
 

Author Comment

by:daskino12
ID: 10852130
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
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10853768
you cannot do that in a messagebox you would have to make your own home made form with a label to do that
0
 

Author Comment

by:daskino12
ID: 10854039
Hello,

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

Thanks


0
 

Author Comment

by:daskino12
ID: 10854085
Hello,

Both links from "http://www.experts-exchange.com/Programming/Wireless_Programming/WinCE/Q_20145674.html" are dead and the working codes is for VB.

Do you have any other references that might be helpful?

Thanks
0
 

Author Comment

by:daskino12
ID: 10854093
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
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10854247
0
 

Author Comment

by:daskino12
ID: 10854747
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
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10855036
thats right

It sounds like you dont have internet conn.
0
 

Author Comment

by:daskino12
ID: 10865443
Hello,

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

Thanks
0
 

Author Comment

by:daskino12
ID: 10865511
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
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10868242
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.
0
 

Author Comment

by:daskino12
ID: 10869029
Hello,

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

Thanks

0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10869591
here is a tutorial im looking for an example
http://www.cs.rpi.edu/courses/fall01/os/CreateProcess.html
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 48

Expert Comment

by:Mikal613
ID: 10869622
not specifically but youll seee code how to use the Function

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

Author Comment

by:daskino12
ID: 10874927
Hello,

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

Thanks
0
 

Author Comment

by:daskino12
ID: 10874958
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
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10875001
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")
0
 

Author Comment

by:daskino12
ID: 10875042
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
0
 

Author Comment

by:daskino12
ID: 10875081
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
0
 

Author Comment

by:daskino12
ID: 10875293
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
0
 

Author Comment

by:daskino12
ID: 10889742
Hello,

Any help?  Thanks
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10890285
Working on it now...
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10890457


>>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);


0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10890534
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"), ...);
0
 
LVL 48

Accepted Solution

by:
Mikal613 earned 500 total points
ID: 10890662
This should do it

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

0
 

Author Comment

by:daskino12
ID: 10892421
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
0
 

Author Comment

by:daskino12
ID: 10892458
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
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10892471
a)you had to convert the type
b)yeah add the code on the Click of the Label which happens to be your link.
0
 

Author Comment

by:daskino12
ID: 10892490
Hello,

What type is "_T"?

Add the code on the click of the label?

THanks
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10892544

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

Author Comment

by:daskino12
ID: 10893375
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
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10894155
that would be nice to make a new question
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10894170
anyways there is no click event you would have to make your own or a hack possibilly is to use the

DragDrop event
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10894174
if that fails you can use a button
0
 

Author Comment

by:daskino12
ID: 10894254
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can't write to Android Internal Memory 3 290
Activesync On Nexus 5x Does Not See Global Address List 1 100
Connect Samsung S5 to PC via USB 13 68
triangle challenge 4 117
Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator (https://www.appcelerator.com/). This article presumes a wor…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now