Jump to content
Sign in to follow this  
name15

can i convert C++ code too autoit

Recommended Posts

name15

can i convert C++ code too autoit code or make it as header file

Share this post


Link to post
Share on other sites
torels

I don't think so... anyway not in an automatic way, you should re-write entirely the code in C++

Anyway if you have an autoit code you want to use in a C++ program you can either use the AutoItX functions OR more simply compile the script as a command line exe and call it from your script :)


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
jvanegmond

Yes, you can convert C++ code to AutoIt manually. Either by doing it yourself or have someone else do it for you.

As far as header files go; AutoIt doesn't have them. Just take your time by writing some function prototypes in AutoIt.

Share this post


Link to post
Share on other sites
name15

here sample example code in C++ so how can convert it

#include "stdafx.h"

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    char shellcode[] =


MessageBox (0,"Hello word",0,0);

return 0;
}

Share this post


Link to post
Share on other sites
jvanegmond

here sample example code in C++ so how can convert it

#include "stdafx.h"

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    char shellcode[] =


MessageBox (0,"Hello word",0,0);

return 0;
}

MsgBox(0, "", "Hello word")

Edit: I think you want to convert your dll calls into AutoIt dll calls.

Like this (SEe documentation on DllCall)

DllCall("user32.dll","long","MessageBox","long",0,"str", "Hello word","str", "","long", 0)
Edited by Manadar

Share this post


Link to post
Share on other sites
name15

no but how you can make it as

function

Edited by name15

Share this post


Link to post
Share on other sites
name15

thank

but i try whit this code DenyAccess to protect you project when it running

#define _WIN32_WINNT 0x0500

#include <windows.h>
#include <sddl.h>
#include <accctrl.h>
#include <stdio.h>
#include <conio.h>
#include <aclapi.h>

BOOL ProtectProcess(HANDLE hProcess);

void main(void)
{
    HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());

    ProtectProcess(hProc);

    printf("SetProcessDacl - Keep a process from being closed by other applications.\nDeveloped by ANUBIS");

    while(TRUE)
    {
        Sleep(100);
    }

}

BOOL ProtectProcess(HANDLE hProcess)
{
    SECURITY_ATTRIBUTES sa;

    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
    sa.bInheritHandle = FALSE;

    if (!ConvertStringSecurityDescriptorToSecurityDescriptor("D:P", SDDL_REVISION_1, &(sa.lpSecurityDescriptor), NULL))
        return FALSE;

    if (!SetKernelObjectSecurity(hProcess, DACL_SECURITY_INFORMATION, sa.lpSecurityDescriptor))
        return FALSE;

    return TRUE;

}

Share this post


Link to post
Share on other sites
name15

ok

but sme time we don't have call dll so we need some fuction in C++ Code how we control it

Share this post


Link to post
Share on other sites
name15

i find this function LockFile in kernel32.dll but i didn't how can i use it

Share this post


Link to post
Share on other sites
Jos

i find this function LockFile in kernel32.dll but i didn't how can i use it

Ok, now first spent some time to explain what it is you want to accomplish here....

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
name15

LockFile(hAppend, dwPos, 0, dwBytesRead, 0);

DllCall("Kernel32.dll","long","LockFile","long","C:\1.wav","str", 0,"str", 0,"str", 0)

not work

Edited by name15

Share this post


Link to post
Share on other sites
Jos

LockFile(hAppend, dwPos, 0, dwBytesRead, 0);

DllCall("Kernel32.dll","long","LockFile","long","C:\1.wav","str", 0,"str", 0,"str", 0)

not work

I understood that, but what are you trying to do with this script you are creating?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
name15

Locks the specified file adding more function to my script

Share this post


Link to post
Share on other sites
Jos

Locks the specified file adding more function to my script

Try to use a some more words to explain what it is you want to accomplish.

I understand your native language isn't English but you will have to try to make it clear what you want to do for us to be able top help you.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
name15

ok i am try to add more function using MSDN Libery

by use DLL() but i don't how can use this Function

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.