Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Example DLL translation from VBA into Xbasic

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • martinwcole
    replied
    RE: Example DLL translation from VBA into Xbasic

    thanks Bill - yes I tried several possibilities, but can't get it to work.

    usually, I do this in bat files, and use sys_shell to call them

    Leave a comment:


  • whanigsberg
    replied
    RE: Example DLL translation from VBA into Xbasic

    Martin,

    Have you tried single quotes around the paths with spaces in them?

    I've never tried this but I wonder if you sys_shell would accept a path in a variable. This would be worth knowing.

    Bill

    Leave a comment:


  • martinwcole
    replied
    RE: Example DLL translation from VBA into Xbasic

    Finnian, I meant using the sys_shell_wait()

    otherwise I just use batch files

    I was referring to what you mentioned:

    Anyhow, the one you posted works perfectly including - and for me this is a real biggie - with CMD files such as copying the contents of a big folder or whatever else one might do in a dos window.

    I can see the obvious benefits of this function when you want to stop processing until notepad or word or excel was closed, but for issuing other dos commands I can't get the syntax correct, as it apparently all has to be enclosed in quotes.

    for example, the following works (where all words are 8 or fewer characters in length):
    sys_shell_wait("xcopy c:\alpha\newha\test33\*.* c:\alpha\newha\test34\*.* /E /Y",.t.)

    whereas the following won't:
    sys_shell_wait("xcopy c:\alpha\newha\Practice Before Multiple States\*.* c:\alpha\newha\test34\*.* /E /Y",.t.)

    I was wondering how to write the second one.

    Leave a comment:


  • Finian Lennon
    replied
    RE: Example DLL translation from VBA into Xbasic

    Martin:


    xcopy "c:\alpha\newha\Practice Before Multiple States\*.*"
    "c:\alpha\newha\test33\*.*" /E /Y

    On one line should do it. Iy will copy all files and folders and overwrite existing files without a prompt.

    Finian

    Leave a comment:


  • martinwcole
    replied
    RE: Example DLL translation from VBA into Xbasic

    Finnian, what would the syntax be for copying the contents of
    c:\alpha\newha\Practice Before Multiple States\*.*
    to
    c:\alpha\newha\test33\*.*

    Leave a comment:


  • Marcel Kollenaar
    replied
    RE: Example DLL translation from VBA into Xbasic

    Hi Peter,

    First, let me thank you very much for this compressed example you provided here. It's a master piece in my opinion. You gave me with your reply the answer at a question I just wanted to ask. It's about the use of DECLARESTRUCT and TYPE...END TYPE. I was just doing the splits.
    The people of Alpha Five told me to use the TYPE..END TYPE construction, however I never managed to get it to work in that way. Therefore I kept using the old DECLARESTRUCTs.

    With your information I start changing my code.

    About the fact that there could be an error in the VB code, yes it's possible. I didn't run this code, I used it only for comparison and I was in the middle of a study of it. I would probably overlooked the error ;-)

    Let me be clear about the source of the code. This isn't mine. The Xbasic code is written by Selwyn and the VB code is Lissauers and I found it by accidental on a VB site.

    Peter you helped me a lot.

    Regards,

    Marcel

    Leave a comment:


  • Finian Lennon
    replied
    RE: Example DLL translation from VBA into Xbasic

    Hi Peter:

    This is great. Hats off to you and Marcel for these examples. I was planning to test Marcel's sys_shell_wait this weekend since I was never able to get Selwyn's original to work for some reason.

    Anyhow, the one you posted works perfectly including - and for me this is a real biggie - with CMD files such as copying the contents of a big folder or whatever else one might do in a dos window.

    Finian

    Leave a comment:


  • Peter.Wayne
    replied
    RE: Example DLL translation from VBA into Xbasic

    Marcel,
    Thank you, that's very valuable. You should also know that A5 lets you create user-defined types, just like VB, so that it becomes easier to modify VB code. Your code could be compressed like this, and I believe this is clearer, and more similar to VB:
    Code:
    command="Notepad.exe"
    sys_shell_wait(command,.t.)
    ui_msg_box("Notepad","was closed")
    end 
    
    FUNCTION sys_shell_wait AS V (command_line AS C, show_window AS L )
    
    ' declare types and hooks to WinAPI
    
    type startupinfo 
    	cb as Integer
    	lpReserved as C
    	lpDesktop as C
    	lpTitle AS C
    	dwX AS Integer
    	dwY AS Integer
    	dwXSize AS Integer
    	dwYSize AS Integer
    	dwXCountChars AS Integer 
    	dwYCountChars AS Integer
    	dwFillAttribute AS Integer
    	dwFlags AS Integer
    	wShowWindow AS Integer
    	cbReserved2 AS Integer
    	lpReserved2 AS Integer
    	hStdInput AS Integer
    	StdOutput AS Integer
    	hStdError AS Integer
    end type
    
    type process_information
    	hprocess as Integer
    	hThread as Integer
    	dwProcessID as Integer
    	dwThreadID as Integer
    end type 
    
    ' hooks to WinAPI
    declare KERNEL32 WaitForSingleObject LLL
    declare KERNEL32 CreateProcessA LLCLLLLLL(STARTUPINFO)(PROCESS_INFORMATION)
    declare KERNEL32 CloseHandle LL
    
    appExec(command_line, show_window)
    END FUNCTION
    
    FUNCTION appExec AS V (commandLine AS C, show_window AS L )
    CONSTANT NORMAL_PRIORITY_CLASS = hex_to_dec("20")	
    CONSTANT INFINITE = hex_to_dec("FFFFFFFF")
    
    dim start as {startupinfo}
    dim proc as {process_information}
    Dim nMilliseconds As N
    
    nMilliseconds = INFINITE
    IF show_window
    	Start.dwFlags = 4
    	Start.wShowWindow = 1
    ELSE
    	Start.dwFlags = 1
    	Start.wShowWindow = 0
    END IF
    
    CreateProcessA(0,CommandLine, 0, 0, 1, NORMAL_PRIORITY_CLASS, 0, 0, Start, proc)
    WaitForSingleObject(proc.hProcess, nMilliseconds)
    CloseHandle(proc.hThread)
    
    END FUNCTION
    There's also an error, I think, in the VB code that you provide. The CreateProcessA declaration takes a long as its first parameterm, followed by a string. So comparing Lissauer's code with yours (or Selwyn's, I'm not sure whose) doesn't work properly because Lissauer is calling CreateProcessA with the wrong parameter list. At least that's what the Microsoft knowledge base indicates in their description of using CreateProcessA.

    Leave a comment:


  • Example DLL translation from VBA into Xbasic

    Hi,

    I'm i the mood for code translation and espcially from VB(A) into Xbasic with an emphasis on DLL's.

    Selwyn Rabins wrote in 2002 a piece of Xbasic code for the sys_shell_wait() routine. Now I found the counter part of it in Visual Basic. It's nice to have two pieces of "heavy" code and see the translation of it (see attachment). We can learn a lot of it. It will help you a lot in translating VB code which calls dll's. There is a tremendous amount of VB code ready for use in Xbasic. Ehhh, at least if you can use it.

    Take also a look at the Win32s Programmer's Reference.hlp (API) for the specific functions and structures used and you see a translation-triangle C-VB-Xbasic. Don't forget to read the very good information on "Pie Charts in Alpha Five" by Dr. Peter Wayne http://learn alpha.com/PieCharts/PieCharts.htm.

    Regards,

    Marcel
Working...
X