Xandy

SDL2_HelloWorld C++

1 post in this topic

#1 ·  Posted (edited)

I wanted to start using SDL2 libraries in C++.

This is a Hello World project that covers some of the essentials of programming with SDL2.

I will use it when I forget how to create an SDL2 project.

  1. Loads a scrolling background image for world.
  2. Mouse position, left click, and double click example.
  3. Hotkeys and cooldown timers to prevent hotkey spam.
  4. Plays background music. (ALT + P)
  5. Plays sound effects changing sprite type. (numpad: /, *, -, +)
  6. Features a Player class for multiplayer.
  7. Player collision detection.
  8. Uses a Window class from Lazyfoo for maximize button, fullscreen ext..
  9. Built using MSVS 2013 (free).  All dlls and libraries included and linked (for MSVS) using relative paths.
  10. You can probably run the SDL2_HelloWorld.sln without setting up any libraries.
  11. Note SDL_Net is setup but not used.
  12. Delta time used to create consistent frame rate across machines.
  13. Player animation sprite sheet:
Spoiler

DW3_Char_SpriteSheet.png


 

 

Demo: Slimy's First Kiss

Download Source and project: http://songersoft.com/programming/sdl2_helloworld/sdl2_helloworld_about.phtml

This isn't meant to be amazing.  It's just to help get started with SDL2.

I will consider any criticism.

main.cpp

// This example HelloWorld followed this video:
// https://www.youtube.com/watch?v=M4Jgz0wEQxY
// Turned into this
// https://www.youtube.com/watch?v=yRpen8jOa08&list=PL77-op_SRaiEuC0YC43ZAUJJwL_G_C2z8&index=15
// Window class was copied from Lazyfoo
// http://lazyfoo.net/tutorials/SDL/35_window_events/index.php

#include <iostream>
#include <string>

#include "SDL.h"
#include "SDL_image.h"
#include "SDL_ttf.h"
#include "SDL_mixer.h"
#include "SDL_net.h"
#include "Player.h"
#include "Window.h"

using namespace std;

// Prototypes
SDL_Texture *LoadTexture(string filepath, SDL_Renderer *renderTarget);
void logSDLError(const string);
SDL_Rect sdlrect(int, int, int, int);
SDL_Surface *OptimizedSurface(string filepath, SDL_Surface *windowSurface);

// if(okAlt) either Alt key is pressed OrKeyALT
#define okAlt (k[SDL_SCANCODE_RALT] || k[SDL_SCANCODE_LALT])

int main(int argc, char *argv[]) {

    // Needed for the initialize block
    Window window;
    SDL_Renderer *renderTarget = nullptr;

    // Initialize SDL2
    if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
        logSDLError("SDL_Init ");
    }

    // Initialize SDL_image
    if (!(IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG)) {
        cout << "Could not initialize SDL_image: " << IMG_GetError() << std::endl;
        SDL_Delay(5500);
    }

    // Initialize TTF
    if (TTF_Init() < 0)
        cout << "TTF_Init " << TTF_GetError() << endl;

    //Create window
    if (!window.init("SDL2 Hello World", 640, 480, "../../Graphics/iconbmp.bmp")) {
        printf("Window could not be created! SDL Error: %s\n", SDL_GetError());
    }
    else
    {
        //Create renderer for window
        renderTarget = window.createRenderer();
        if (renderTarget == NULL) {
            printf("Renderer could not be created! SDL Error: %s\n", SDL_GetError());
        }
    }

    // Audio
    if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0) {
        cout << "Mix_OpenAudio: " << Mix_GetError() << endl;
    }

    // Load sounds: Run chunk if less than 10 sec, music if greater (generally)
    //Mix_Music *bgm = Mix_LoadMUS("../../Sounds/overworld.mid"); // Can't Pause MIDI
    Mix_Music *bgm = Mix_LoadMUS("../../Sounds/bensound-goinghigher.mp3");
    cout << Mix_GetError() << endl;

    // Font and text
    SDL_Texture *text_texture = nullptr;
    SDL_Color textColor = { 144, 77, 255, 255 };
    TTF_Font *font = TTF_OpenFont("../../Graphics/Fonts/VCR_OSD_MONO.ttf", 20);
    if (font) {
        SDL_Surface *textSurf = TTF_RenderText_Solid(font, "Hello world", textColor);
        text_texture = SDL_CreateTextureFromSurface(renderTarget, textSurf);
        SDL_FreeSurface(textSurf);
    } else
        cout << TTF_GetError() << endl;

    SDL_Rect textRect = { 0, 0, 0, 0 };// Position of text on window
    // Get the size of the text_texture
    SDL_QueryTexture(text_texture, NULL, NULL, &textRect.w, &textRect.h);

    const int playerMax = 8;
    int players = 2;

    float prevTime = 0, currentTime = 0, deltaTime = 0;
    bool fullscreen_toggle = 0;
    int i = 0, ii = 0;
    int redraw = 1;
    bool done = 0;

    // Load player sprite sheet and background texture
    SDL_Texture *spritesheet_texture = LoadTexture("../../Graphics/DW3_Char_SpriteSheet.png", renderTarget);
    SDL_Texture *bg_texture = LoadTexture("../../Graphics/dw3-over.png", renderTarget);
    int bg_texture_w = 0, bg_texture_h = 0;

    // Point k to Keyboard state (only needs done here, not in main loop)
    const Uint8 *k = SDL_GetKeyboardState(NULL);

    SDL_Event windowEvent;

    // Stop keys spamming (like music ON / OFF)
    float key_cooldown_timer_max = 500.0f, key_cooldown_timer = 0;

    SDL_Rect cameraRect = { 0, 0, window.getWidth(), window.getHeight()};

    // Construct default players
    Player player[playerMax];
    // Customize players (texture and position)
    for (i = 0; i < players; i++)//(sprite texture, position x, position y)
        player[i].Player_new(spritesheet_texture, window.getWidth() / 2 + i * 16, window.getHeight() / 2);

    // Get the size of bg_texture
    SDL_QueryTexture(bg_texture, NULL, NULL, &bg_texture_w, &bg_texture_h);

    // Main message loop
    while (!done) {
        prevTime = currentTime;
        currentTime = SDL_GetTicks();
        deltaTime = (currentTime - prevTime) / 1000.0f;
        while (SDL_PollEvent(&windowEvent) != 0) {
            // Check for events
            if (windowEvent.type == SDL_QUIT) {
                // Window Exit
                done = 1;
            } else if(windowEvent.type == SDL_MOUSEBUTTONDOWN) {
                // Mouse buttons
                if (windowEvent.button.clicks == 2) {
                    // Double left click
                    redraw = 1;
                } else if (windowEvent.button.button == SDL_BUTTON_LEFT) {
                    // Single left click
                    redraw = 1;
                }
                // Output mouse position
                cout << "Mouse: " << windowEvent.button.x << " " << windowEvent.button.y << endl;
            }
        }// if(SDL_PollEvent(&windowEvent))

        if (okAlt) {
            // Either ALT key
            if (k[SDL_SCANCODE_RETURN]) {
                // ALT + ENTER, toggle fullscreen
                // Consider matching current window resolution to closest preset array of valid full screen resolutions.
                fullscreen_toggle = 1;
            }
            if (k[SDL_SCANCODE_P]) {
                if (SDL_GetTicks() - key_cooldown_timer > key_cooldown_timer_max) {
                    // Action cooldown timer is ready.  Avoids ON / OFF flicker
                    // Play Music
                    if (!Mix_PlayingMusic()) {
                        cout << "PLAY";
                        Mix_PlayMusic(bgm, -1);
                    }
                    else if (Mix_PausedMusic()) {
                        cout << "RESUME";
                        Mix_ResumeMusic();
                    }
                    else {
                        cout << "PAUSE";
                        Mix_PauseMusic();
                    }
                    key_cooldown_timer = SDL_GetTicks();
                }
            }// SDL_SCANCODE_P
            if (k[SDL_SCANCODE_S]) {
                // Stop Music
                Mix_HaltMusic();
            }
        }// okAlt

        //Handle window events
        fullscreen_toggle = window.handleEvent(windowEvent, renderTarget, fullscreen_toggle);

        // Player Update and IntersectsWith
        for (i = 0; i < players; i++) {
            player[i].Update(deltaTime, k);
            for (ii = 0; ii < players; ii++) {
                if(i != ii)// Not self
                    player[i].IntersectsWith(player[ii]);
            }
        }

        // Camera
        cameraRect.x = player[0].GetOriginX() - window.getWidth() / 2;
        cameraRect.y = player[0].GetOriginY() - window.getHeight() / 2;
        // Normalize
        if (cameraRect.x < 0)
            cameraRect.x = 0;
        if (cameraRect.y < 0)
            cameraRect.y = 0;

        if (cameraRect.x + cameraRect.w >= bg_texture_w)
            cameraRect.x = bg_texture_w - window.getWidth();
        if (cameraRect.y + cameraRect.h >= bg_texture_h)
            cameraRect.y = bg_texture_h - window.getHeight();

        redraw = 1; // Don't judge me
        if (redraw) {
            // Redraw should definatly pretty much be at the end of loop
            // Clear window
            SDL_RenderClear(renderTarget);

            // Copy camera from bg_texture
            SDL_RenderCopy(renderTarget, bg_texture, &cameraRect, NULL);

            // Draw players
            for (i = 0; i < players; i++)
                player[i].Draw(renderTarget, cameraRect);

            // Print text
            SDL_RenderCopy(renderTarget, text_texture, NULL, &textRect);

            // Show the rendered content
            SDL_RenderPresent(renderTarget);
            redraw = 0;
        }// if(redraw)
        
    }// while(true)
    
    // Free windows
    window.free();

    SDL_DestroyTexture(bg_texture);
    SDL_DestroyTexture(spritesheet_texture);
    SDL_DestroyTexture(text_texture);
    TTF_CloseFont(font);

    // Free Renderers
    SDL_DestroyRenderer(renderTarget);

    // Free music
    Mix_FreeMusic(bgm);

    // Close systems
    Mix_Quit();
    TTF_Quit();
    IMG_Quit();
    SDL_Quit();
    return EXIT_SUCCESS;
}// main()

SDL_Texture *LoadTexture(string filepath, SDL_Renderer *renderTarget) {
    // Create texture
    SDL_Texture *texture = nullptr;
    // Load surface
    SDL_Surface *surface = IMG_Load(filepath.c_str());
    if (surface == NULL) {
        // surface didn't load
        logSDLError("LoadTexture surface ");
    } else {
        SDL_SetColorKey(surface, SDL_TRUE, SDL_MapRGB(surface->format, 0, 0, 0));
        texture = SDL_CreateTextureFromSurface(renderTarget, surface);
        //SDL_SetTextureColorMod(texture, 120, 150, 140);
        if (texture == NULL)
            logSDLError("LoadTexture texture ");
    }

    SDL_FreeSurface(surface);

    return texture;
}

void logSDLError(const string msg){
    cout << msg << " Error: " << SDL_GetError() << endl;
    SDL_Delay(4000);
}

SDL_Rect sdlrect(int x, int y, int w, int h) {
    SDL_Rect rect = {x, y, w, h};
    return rect;
}

SDL_Surface *OptimizedSurface(string filepath, SDL_Surface *windowSurface) {
    SDL_Surface *optimizedSurf = nullptr;
    SDL_Surface *surface = IMG_Load(filepath.c_str());
    if (surface == NULL) {
        cout << "Error: " << endl;
    }
    else {
        optimizedSurf = SDL_ConvertSurface(surface, windowSurface->format, 0);
        if (optimizedSurf == NULL)
            cout << "Error: " << endl;
    }

    SDL_FreeSurface(surface);

    return optimizedSurf;
}

Player.h

#pragma once

#include <iostream>

#include "SDL.h"
#include <String>
#include "SDL_mixer.h"

using namespace std;

enum player_control {
    ePlayer_control_up,
    ePlayer_control_down,
    ePlayer_control_left,
    ePlayer_control_right,
    ePlayer_control_type_minus,
    ePlayer_control_type_plus
};

class Player
{
private:
    SDL_Rect cropRect;
    SDL_Texture *texture;
    int spritesheet_texture_w, spritesheet_texture_h;//size of spritesheet texture
    bool isActive;//animation timer
    SDL_Scancode keys[6];
    int frame_w, frame_h;//16, 16
    float frameTimerMax;
    float frameTimer;//0..frameTimerMax
    int frame;//0..1
    int frameMax;//2
    int way;//0..3 
    int classType;//0..53
    float moveSpeed;
    float cast_cooldown_max;
    Mix_Chunk *soundEffect;
    int originX, originY;
    int radius;
    Uint32 key_cooldown_timer;
    string name;

public:
    void Player_new(SDL_Texture *spritesheet_texture, int x, int y);
    Player();
    ~Player();

    void Update(float delta, const Uint8 *keyState);
    void Draw(SDL_Renderer *renderTarget, SDL_Rect cameraRect);
    bool IntersectsWith(Player &p);
    int GetOriginX();
    int GetOriginY();
    int GetRadius();

    SDL_Rect positionRect;
    
};

Player.cpp

#pragma once

#include "Player.h"
#include "SDL_image.h"
#include "SDL_mixer.h"
#include <iostream>
#include <String>
#include <cmath>
using namespace std;

Player::Player() {
    cropRect = {0, 0, 16, 16};
    texture = nullptr;
    spritesheet_texture_w = spritesheet_texture_h = 0;//size of spritesheet texture
    isActive = false;//animation timer
    keys[6];
    frame_w = frame_h = 16;//16, 16
    frameTimerMax = 0.5f;
    frameTimer = 0;//0..frameTimerMax
    frame = 0;//0..1
    frameMax = 2;//2
    way = 0;//0..3 
    classType = 0;//0..53
    moveSpeed = 200.0f;
    radius = frame_w / 2;
    soundEffect = nullptr;
    key_cooldown_timer = 0;
    cast_cooldown_max = 190.0f;

    static int playerNumber = 0;
    playerNumber++;

    name = "Player:" + to_string(playerNumber);

    // Setup keys for player 1
    // ** I see the enum didn't exist when this was written **
    if (playerNumber == 1) {
        keys[0] = SDL_SCANCODE_W;
        keys[1] = SDL_SCANCODE_S;
        keys[2] = SDL_SCANCODE_A;
        keys[3] = SDL_SCANCODE_D;
        keys[4] = SDL_SCANCODE_KP_MINUS;
        keys[5] = SDL_SCANCODE_KP_PLUS;
    }
    else {
        // Setup keys all other players (not 1)
        keys[0] = SDL_SCANCODE_UP;
        keys[1] = SDL_SCANCODE_DOWN;
        keys[2] = SDL_SCANCODE_LEFT;
        keys[3] = SDL_SCANCODE_RIGHT;
        keys[4] = SDL_SCANCODE_KP_DIVIDE;
        keys[5] = SDL_SCANCODE_KP_MULTIPLY;
    }

}//Player::Player()

void Player::Player_new(SDL_Texture *spritesheet_texture, int x, int y)
{
    // This is new player
    isActive = false;

    // Read size of spritesheet texture
    SDL_QueryTexture(spritesheet_texture, NULL, NULL, &spritesheet_texture_w, &spritesheet_texture_h);

    texture = spritesheet_texture;

    // spritesheet rect
    cropRect = { 0, 0, 16, 16 };

    // player screen position
    positionRect = { x, y, 16, 16 };

    // Defaults
    moveSpeed = 200.0f;
    radius = frame_w / 2;
    frameTimer = 0;
    frame = 0;
    frameMax = 2;
    way = 0;
    classType = 0;
    originX = frame_w / 2;
    originY = frame_h / 2;

    soundEffect = Mix_LoadWAV("../../Sounds/whipcrack1.wav");

    cout << "Name: " << name << endl;

}//Player::Player_new()

void Player::Update(float delta, const Uint8 *keyState) {
    isActive = true;
    if (keyState[keys[ePlayer_control_up]]) {
        way = 0;
        positionRect.y -= moveSpeed * delta;
        cropRect.x = (way * cropRect.w * frameMax) + (frame * cropRect.w);
    }
    if (keyState[keys[ePlayer_control_down]]) {
        way = 1;
        positionRect.y += moveSpeed * delta;
        cropRect.x = (way * cropRect.w * frameMax) + (frame * cropRect.w);
    }
    if (keyState[keys[ePlayer_control_left]]) {
        way = 3;
        positionRect.x -= moveSpeed * delta;
        cropRect.x = (way * cropRect.w * frameMax) + (frame * cropRect.w);
    }
    if (keyState[keys[ePlayer_control_right]]) {
        way = 2;
        positionRect.x += moveSpeed * delta;
        cropRect.x = (way * cropRect.w * frameMax) + (frame * cropRect.w);
    }
    if (keyState[keys[ePlayer_control_type_minus]]) {
        if (SDL_GetTicks() - key_cooldown_timer > cast_cooldown_max) {
            key_cooldown_timer = SDL_GetTicks();
            Mix_PlayChannel(-1, soundEffect, 0);
            classType--;
            if (classType < 0) classType = spritesheet_texture_h / cropRect.h - 1;
            cropRect.y = classType * cropRect.h;
        }
    }   
    if (keyState[keys[ePlayer_control_type_plus]]) {
        if (SDL_GetTicks() - key_cooldown_timer > cast_cooldown_max) {
            key_cooldown_timer = SDL_GetTicks();
            Mix_PlayChannel(-1, soundEffect, 0);
            classType++;
            if (classType >= spritesheet_texture_h / cropRect.h) classType = 0;
            cropRect.y = classType * cropRect.h;
        }
    }

    if (isActive) {
        frameTimer += delta;
        
        if (frameTimer >= frameTimerMax){
            frameTimer = 0;
            cropRect.x = (way * cropRect.w * frameMax) + (frame * cropRect.w);
            if (frame >= frameMax - 1)
                frame = 0;
            else
                frame++;
        }
    }
    else {
        frameTimer = 0;
    }
}//Player::Update()

void Player::Draw(SDL_Renderer *renderTarget, SDL_Rect cameraRect) {
    SDL_Rect drawingRect = { positionRect.x - cameraRect.x, positionRect.y - cameraRect.y, positionRect.w, positionRect.h };
    SDL_RenderCopy(renderTarget, texture, &cropRect, &drawingRect);
}

bool Player::IntersectsWith(Player &p){
    if (sqrt(pow(GetOriginX() - p.GetOriginX(), 2) + pow(GetOriginY() - p.GetOriginY(), 2)) >= radius + p.GetRadius()) {
        SDL_SetTextureColorMod(texture, 255, 255, 255);
        return false;
    }
    SDL_SetTextureColorMod(texture, 255, 0, 0);
    return true;
}

Player::~Player()
{
    SDL_DestroyTexture(texture);
    Mix_FreeChunk(soundEffect);
}

int Player::GetOriginX() { return positionRect.x + originX; }

int Player::GetOriginY() { return positionRect.y + originY; }

int Player::GetRadius() { return radius; }

 

Edited by Xandy
3 people like this

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

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

  • Similar Content

    • likehu
      By likehu
      Hello,
      I have compiled a reference DLL in VS 2015 Community and this  DLL works fine with project for which it is used. There is an interface from which u can access functions in DLL.
      Developers stated that this DLL is almost universal and can be used with any language with minor changes.
      I am trying to access its function from Autoit script and got an error 3, after calling DLLCall - "function" not found in the DLL file.
      Please have a quick look, I feel I miss something in C++ library with exporting functions and I do not know what to add as I am new to C++.
      Thank you.
      Source files and script also attached.
       
      Here is my script.
      Local $dll = DllOpen("C:\Users\Home\Desktop\dll\user.dll") ConsoleWrite("$dll handle = " & $dll & @CRLF) ;$dll handle = 1 Local $result = DllCall($dll, "double:cdecl", "ProcessQuery", "str", "dll$mynumber") If @error > 0 Then ConsoleWrite("Error: " & @error & @CRLF) ;Error = 3 If IsArray($result) Then ConsoleWrite("Array returned!" & @CRLF & "dll$mynumber: " & result[1]) Else ConsoleWrite("$result is not array. : " & $result & @CRLF) ;$result = 0 EndIf DllClose($dll) And here is dll source. As I understand, function "ProcessQuery" exported with help of DLL_IMPLEMENTS
      user.h
      //****************************************************************************** // // This file is part of the OpenHoldem project // Download page: http://code.google.com/p/openholdembot/ // Forums: http://www.maxinmontreal.com/forums/index.php // Licensed under GPL v3: http://www.gnu.org/licenses/gpl.html // //****************************************************************************** // // Purpose: Very simple user-DLL as a starting-point // // DO NOT CHANGE ANYTHING IN THIS FILE! // // This Header defines an interface // Functions and data-types must exactly match. // //****************************************************************************** #ifndef _INC_USER_H #define _INC_USER_H // Import and export directives // for use by this DLL and by OpenHoldem #ifdef USER_DLL #define DLL_IMPLEMENTS extern "C" __declspec(dllexport) #define EXE_IMPLEMENTS extern "C" __declspec(dllimport) #else #define DLL_IMPLEMENTS extern "C" __declspec(dllimport) #define EXE_IMPLEMENTS extern "C" __declspec(dllexport) #endif // Number of saved table-states // This number must not be changed, as we do a "& 0xFF" // at various places to normalize the index. const int kNumberOfHoldemStatesForDLL = 256; // SHoldemePlayer // used for sequence of 256 consequive table-states // !!!! Needs 2 more cards for Omaha, if not entirely removed struct holdem_player { char m_name[16] ; //player name if known double m_balance ; //player balance double m_currentbet ; //player current bet unsigned char m_cards[2] ; //player cards unsigned char m_name_known : 1 ; //0=no 1=yes unsigned char m_balance_known : 1 ; //0=no 1=yes unsigned char m_fillerbits : 6 ; //filler bits unsigned char m_fillerbyte ; //filler bytes }; struct holdem_state { char m_title[64] ; //table title double m_pot[10] ; //total in each pot unsigned char m_cards[5] ; //common cards unsigned char m_is_playing : 1 ; //0=sitting-out, 1=sitting-in unsigned char m_is_posting : 1 ; //0=autopost-off, 1=autopost-on unsigned char m_fillerbits : 6 ; //filler bits unsigned char m_fillerbyte ; //filler byte unsigned char m_dealer_chair ; //0-9 holdem_player m_player[10] ; //player records }; // Functions implemented and exported by the DLL, // imported by OpenHoldem DLL_IMPLEMENTS double __stdcall ProcessQuery(const char* pquery); DLL_IMPLEMENTS void __stdcall DLLOnLoad(); DLL_IMPLEMENTS void __stdcall DLLOnUnLoad(); // Functions implemented and exported by OpenHoldem, // imported by the DLL EXE_IMPLEMENTS double __stdcall GetSymbol(const char* name_of_single_symbol__not_expression); EXE_IMPLEMENTS void* __stdcall GetPrw1326(); EXE_IMPLEMENTS char* __stdcall GetHandnumber(); EXE_IMPLEMENTS void __stdcall ParseHandList(const char* name_of_list, const char* list_body); EXE_IMPLEMENTS char* __stdcall ScrapeTableMapRegion(char* p_region, int& p_returned_lengh); EXE_IMPLEMENTS void __stdcall SendChatMessage(const char *message); EXE_IMPLEMENTS void __stdcall WriteLog(char* format, ...); // Variables exported by OpenHoldem // avoiding the message-mess of WinHoldem, // no longer sending any state-messages // http://www.maxinmontreal.com/forums/viewtopic.php?f=174&t=18642 EXE_IMPLEMENTS extern holdem_state state[kNumberOfHoldemStatesForDLL]; EXE_IMPLEMENTS extern int state_index; #endif // _INC_USER_H  
      user.cpp    Here is dll$mynumber parameter.
      //****************************************************************************** // // This file is part of the OpenHoldem project // Download page: http://code.google.com/p/openholdembot/ // Forums: http://www.maxinmontreal.com/forums/index.php // Licensed under GPL v3: http://www.gnu.org/licenses/gpl.html // //****************************************************************************** // // Purpose: Very simple user-DLL as a starting-point // // Required OpenHoldem version: 7.7.6 // //****************************************************************************** // Needs to be defined here, before #include "user.h" // to generate proper export- and inport-definitions #define USER_DLL // #define OPT_DEMO_OUTPUT if you are a beginner // who wants to see some message-boxes with output of game-states, etc. // It is disabled upon request, // * as it is not really needed // * as some DLL-users don't have MFC (atlstr.h) installed // http://www.maxinmontreal.com/forums/viewtopic.php?f=156&t=16232 #undef OPT_DEMO_OUTPUT #include "user.h" #include <conio.h> #include <windows.h> #ifdef OPT_DEMO_OUTPUT #include <atlstr.h> #endif OPT_DEMO_OUTPUT // Supporting macros #define HIGH_NIBBLE(c) (((c)>>4)&0x0F) #define LOW_NIBBLE(c) ((c)&0x0F) // Card macro #define RANK(c) ( ISKNOWN(c) ? HIGH_NIBBLE(c) : 0 ) #define SUIT(c) ( ISKNOWN(c) ? LOW_NIBBLE(c) : 0 ) #define ISCARDBACK(c) ((c) == CARD_BACK) #define ISUNKNOWN(c) ((c) == CARD_UNDEFINED) #define ISNOCARD(c) ((c) == CARD_NOCARD) #define ISKNOWN(c) (!ISCARDBACK(c) && !ISUNKNOWN(c) && !ISNOCARD(c)) // ProcessQuery() // Handling the lookup of dll$symbols DLL_IMPLEMENTS double __stdcall ProcessQuery(const char* pquery) { if (pquery==NULL) return 0; if (strncmp(pquery,"dll$mynumber",13)==0) { return 12345.67; } return 0; } // OnLoad and OnUnload() // called once and at the beginning of a session // when the DLL gets loaded / unloaded // Do initilization / finalization here. DLL_IMPLEMENTS void __stdcall DLLOnLoad() { #ifdef OPT_DEMO_OUTPUT MessageBox(NULL, "event-load", "MESSAGE", MB_OK); #endif OPT_DEMO_OUTPUT } DLL_IMPLEMENTS void __stdcall DLLOnUnLoad() { #ifdef OPT_DEMO_OUTPUT MessageBox(NULL, "event-unload", "MESSAGE", MB_OK); #endif OPT_DEMO_OUTPUT } // DLL entry point // Technically required, but don't do anything here. // Initializations belong into the OnLoad() function, // where they get executed at run-time. // Doing things here at load-time is a bad idea, // as some functionalitz might not be properly initialized // (including error/handling). BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: #ifdef OPT_DEMO_OUTPUT AllocConsole(); #endif OPT_DEMO_OUTPUT break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: #ifdef OPT_DEMO_OUTPUT FreeConsole(); #endif OPT_DEMO_OUTPUT break; } return TRUE; }  
      Source.zip
      DllAccess.au3
    • wakillon
      By wakillon
      A little try with SDL 2 Library, SDL 2 GFX and Sid music.
      As usual, no externals files needed.
      Press "Esc" for quit.
      SDL2_Fireworks.au3
      Happy New Year 2017 
    • powerbass4
      By powerbass4
      Hi, I need the help of some "C++ Pros" of you....

      The "WINAPI GetLogicalProcessorInformation" function does not exists in the AutoIt Includes, so I decided to build it on my own ....no success so far.
      I adapted easy functions, but this one seems to be odd and unfamiliar.

      I hope somebody can help me.... and after that this function should be added to the Includes (WinAPISys.au3).
       
      BOOL WINAPI GetLogicalProcessorInformation( _Out_ PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, _Inout_ PDWORD ReturnLength ); https://msdn.microsoft.com/en-us/library/windows/desktop/ms683194(v=vs.85).aspx
       
      typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION { ULONG_PTR ProcessorMask; LOGICAL_PROCESSOR_RELATIONSHIP Relationship; union { struct { BYTE Flags; } ProcessorCore; struct { DWORD NodeNumber; } NumaNode; CACHE_DESCRIPTOR Cache; ULONGLONG Reserved[2]; }; } SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION; https://msdn.microsoft.com/en-us/library/windows/desktop/ms686694(v=vs.85).aspx
    • argumentum
      By argumentum
      The nice ppl of voidtools created Everything Search Engine ( " Locate files and folders by name instantly. " )  
      And made a CLI program to search from the command line. They also gave the source code, and reading it, I see the IPC quite familiar.
      // // // source for CLI.H // Everything IPC test // revision 2: // fixed command line interpreting '-' as a switch inside text. // revision 3: // convert unicode to same code page as console. // revision 4: // removed write console because it has no support for piping. // revision 5: // added ChangeWindowMessageFilterEx (if available) for admin/user support. // compiler options #pragma warning(disable : 4311) // type cast void * to unsigned int #pragma warning(disable : 4312) // type cast unsigned int to void * #pragma warning(disable : 4244) // warning C4244: 'argument' : conversion from 'LONG_PTR' to 'LONG', possible loss of data #pragma warning(disable : 4996) // deprecation #include <windows.h> #include <stdio.h> #include "everything_ipc.h" #define COPYDATA_IPCTEST_QUERYCOMPLETEW 0 #define MSGFLT_RESET 0 #define MSGFLT_ALLOW 1 #define MSGFLT_DISALLOW 2 typedef struct tagCHANGEFILTERSTRUCT { DWORD cbSize; DWORD ExtStatus; } CHANGEFILTERSTRUCT, *PCHANGEFILTERSTRUCT; static void write(wchar_t *text); static void write_DWORD(DWORD value); static int wstring_to_int(const wchar_t *s); int sort = 0; EVERYTHING_IPC_LIST *sort_list; HMODULE user32_hdll = 0; BOOL (WINAPI *pChangeWindowMessageFilterEx)(HWND hWnd,UINT message,DWORD action,PCHANGEFILTERSTRUCT pChangeFilterStruct) = 0; int wstring_length(const wchar_t *s) { const wchar_t *p; p = s; while(*p) { p++; } return (int)(p - s); } // query everything with search string int sendquery(HWND hwnd,DWORD num,WCHAR *search_string,int regex,int match_case,int match_whole_word,int match_path) { EVERYTHING_IPC_QUERY *query; int len; int size; HWND everything_hwnd; COPYDATASTRUCT cds; everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0); if (everything_hwnd) { len = wstring_length(search_string); size = sizeof(EVERYTHING_IPC_QUERY) - sizeof(WCHAR) + len*sizeof(WCHAR) + sizeof(WCHAR); query = (EVERYTHING_IPC_QUERY *)HeapAlloc(GetProcessHeap(),0,size); if (query) { query->max_results = num; query->offset = 0; query->reply_copydata_message = COPYDATA_IPCTEST_QUERYCOMPLETEW; query->search_flags = (regex?EVERYTHING_IPC_REGEX:0) | (match_case?EVERYTHING_IPC_MATCHCASE:0) | (match_whole_word?EVERYTHING_IPC_MATCHWHOLEWORD:0) | (match_path?EVERYTHING_IPC_MATCHPATH:0); query->reply_hwnd = hwnd; CopyMemory(query->search_string,search_string,(len+1)*sizeof(WCHAR)); cds.cbData = size; cds.dwData = EVERYTHING_IPC_COPYDATAQUERY; cds.lpData = query; if (SendMessage(everything_hwnd,WM_COPYDATA,(WPARAM)hwnd,(LPARAM)&cds) == TRUE) { HeapFree(GetProcessHeap(),0,query); return 1; } else { write(L"Everything IPC service not running.\n"); } HeapFree(GetProcessHeap(),0,query); } else { write(L"failed to allocate "); write_DWORD(size); write(L" bytes for IPC query.\n"); } } else { // the everything window was not found. // we can optionally RegisterWindowMessage("EVERYTHING_IPC_CREATED") and // wait for Everything to post this message to all top level windows when its up and running. write(L"Everything IPC window not found, IPC unavailable.\n"); } return 0; } int compare_list_items(const void *a,const void *b) { int i; i = wcsicmp(EVERYTHING_IPC_ITEMPATH(sort_list,a),EVERYTHING_IPC_ITEMPATH(sort_list,b)); if (!i) { return wcsicmp(EVERYTHING_IPC_ITEMFILENAME(sort_list,a),EVERYTHING_IPC_ITEMFILENAME(sort_list,b)); } else if (i > 0) { return 1; } else { return -1; } } static void write(wchar_t *text) { DWORD mode; int wlen; DWORD numwritten; HANDLE output_handle; output_handle = GetStdHandle(STD_OUTPUT_HANDLE); wlen = wstring_length(text); if (GetConsoleMode(output_handle,&mode)) { WriteConsoleW(output_handle,text,wlen,&numwritten,0); } else { char *buf; int len; len = WideCharToMultiByte(GetConsoleCP(),0,text,wlen,0,0,0,0); if (len) { buf = HeapAlloc(GetProcessHeap(),0,len); if (buf) { WideCharToMultiByte(GetConsoleCP(),0,text,wlen,buf,len,0,0); WriteFile(output_handle,buf,len,&numwritten,0); HeapFree(GetProcessHeap(),0,buf); } } } } static void write_DWORD(DWORD value) { wchar_t buf[256]; wchar_t *d; d = buf + 256; *--d = 0; if (value) { DWORD i; i = value; while(i) { *--d = '0' + (i % 10); i /= 10; } } else { *--d = '0'; } write(d); } void listresultsW(EVERYTHING_IPC_LIST *list) { DWORD i; if (sort) { sort_list = list; qsort(list->items,list->numitems,sizeof(EVERYTHING_IPC_ITEM),compare_list_items); } for(i=0;i<list->numitems;i++) { if (list->items[i].flags & EVERYTHING_IPC_DRIVE) { write(EVERYTHING_IPC_ITEMFILENAME(list,&list->items[i])); write(L"\r\n"); } else { write(EVERYTHING_IPC_ITEMPATH(list,&list->items[i])); write(L"\\"); write(EVERYTHING_IPC_ITEMFILENAME(list,&list->items[i])); write(L"\r\n"); } } PostQuitMessage(0); } // custom window proc LRESULT __stdcall window_proc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch(msg) { case WM_COPYDATA: { COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lParam; switch(cds->dwData) { case COPYDATA_IPCTEST_QUERYCOMPLETEW: listresultsW((EVERYTHING_IPC_LIST *)cds->lpData); return TRUE; } break; } } return DefWindowProc(hwnd,msg,wParam,lParam); } void help(void) { write(L"-r Search the database using a basic POSIX regular expression.\n"); write(L"-i Does a case sensitive search.\n"); write(L"-w Does a whole word search.\n"); write(L"-p Does a full path search.\n"); write(L"-h --help Display this help.\n"); write(L"-n <num> Limit the amount of results shown to <num>.\n"); write(L"-s Sort by full path.\n"); } // main entry int main(int argc,char **argv) { WNDCLASSEX wcex; HWND hwnd; MSG msg; int ret; int q; wchar_t *search; wchar_t *d; wchar_t *e; wchar_t *s; int match_whole_word = 0; int match_path = 0; int regex = 0; int match_case = 0; int wasexename = 0; int matchpath = 0; int i; int wargc; wchar_t **wargv; DWORD num = EVERYTHING_IPC_ALLRESULTS; ZeroMemory(&wcex,sizeof(wcex)); wcex.cbSize = sizeof(wcex); if (!GetClassInfoEx(GetModuleHandle(0),TEXT("IPCTEST"),&wcex)) { ZeroMemory(&wcex,sizeof(wcex)); wcex.cbSize = sizeof(wcex); wcex.hInstance = GetModuleHandle(0); wcex.lpfnWndProc = window_proc; wcex.lpszClassName = TEXT("IPCTEST"); if (!RegisterClassEx(&wcex)) { write(L"failed to register IPCTEST window class\n"); return 1; } } if (!(hwnd = CreateWindow( TEXT("IPCTEST"), TEXT(""), 0, 0,0,0,0, 0,0,GetModuleHandle(0),0))) { write(L"failed to create IPCTEST window\n"); return 1; } // allow the everything window to send a reply. user32_hdll = LoadLibrary(L"user32.dll"); if (user32_hdll) { pChangeWindowMessageFilterEx = (BOOL (WINAPI *)(HWND hWnd,UINT message,DWORD action,PCHANGEFILTERSTRUCT pChangeFilterStruct))GetProcAddress(user32_hdll,"ChangeWindowMessageFilterEx"); if (pChangeWindowMessageFilterEx) { pChangeWindowMessageFilterEx(hwnd,WM_COPYDATA,MSGFLT_ALLOW,0); } } wargv = CommandLineToArgvW(GetCommandLineW(),&wargc); search = HeapAlloc(GetProcessHeap(),0,65536); if (!search) { write(L"failed to allocate "); write_DWORD(65536); write(L" bytes for search buffer.\n"); if (user32_hdll) { FreeLibrary(user32_hdll); } return 1; } d = search; // allow room for null terminator e = search + (65536 / sizeof(wchar_t)) - 1; wargc--; i = 0; for(;;) { if (i >= wargc) break; if (wcsicmp(wargv[i+1],L"-r") == 0) { regex = 1; } else if (wcsicmp(wargv[i+1],L"-i") == 0) { match_case = 1; } else if (wcsicmp(wargv[i+1],L"-w") == 0) { match_whole_word = 1; } else if (wcsicmp(wargv[i+1],L"-p") == 0) { match_path = 1; } else if (wcsicmp(wargv[i+1],L"-s") == 0) { sort = 1; } else if ((wcsicmp(wargv[i+1],L"-n") == 0) && (i + 1 < wargc)) { i++; num = wstring_to_int(wargv[i+1]); } else if (wargv[i+1][0] == '-') { // unknwon command help(); HeapFree(GetProcessHeap(),0,search); if (user32_hdll) { FreeLibrary(user32_hdll); } return 1; } else { // keep quotes ? q = 0; s = wargv[i+1]; while(*s) { if ((*s == ' ') || (*s == '\t') || (*s == '\r') || (*s == '\n')) { q = 1; break; } s++; } if ((d != search) && (d < e)) *d++ = ' '; if (q) { if (d < e) *d++ = '"'; } // copy append to search s = wargv[i+1]; while(*s) { if (d < e) *d++ = *s; s++; } if (q) { if (d < e) *d++ = '"'; } } i++; } // null terminate *d = 0; if (!sendquery(hwnd,num,search,regex,match_case,match_whole_word,match_path)) { // send query reports error HeapFree(GetProcessHeap(),0,search); if (user32_hdll) { FreeLibrary(user32_hdll); } return 1; } HeapFree(GetProcessHeap(),0,search); // message pump loop: // update windows if (PeekMessage(&msg,NULL,0,0,0)) { ret = (int)GetMessage(&msg,0,0,0); if (ret <= 0) goto exit; // let windows handle it. TranslateMessage(&msg); DispatchMessage(&msg); } else { WaitMessage(); } goto loop; exit: if (user32_hdll) { FreeLibrary(user32_hdll); } return 0; } static int wstring_to_int(const wchar_t *s) { const wchar_t *p; int value; p = s; value = 0; while(*p) { if (!((*p >= '0') && (*p <= '9'))) { break; } value *= 10; value += *p - '0'; p++; } return value; } // // // source for everything_ipc.h // Everything IPC #ifndef _EVERYTHING_IPC_H_ #define _EVERYTHING_IPC_H_ // C #ifdef __cplusplus extern "C" { #endif // 1 byte packing for our varible sized structs #pragma pack(push, 1) // WM_USER (send to the taskbar notification window) // SendMessage(FindWindow(EVERYTHING_IPC_WNDCLASS,0),WM_USER,EVERYTHING_IPC_*,lParam) // version format: major.minor.revision.build // example: 1.1.4.309 #define EVERYTHING_IPC_GET_MAJOR_VERSION 0 // int major_version = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_MAJOR_VERSION,0); #define EVERYTHING_IPC_GET_MINOR_VERSION 1 // int minor_version = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_MINOR_VERSION,0); #define EVERYTHING_IPC_GET_REVISION 2 // int revision = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_REVISION,0); #define EVERYTHING_IPC_GET_BUILD_NUMBER 3 // int build = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_BUILD,0); // find the everything window #define EVERYTHING_IPC_WNDCLASS TEXT("EVERYTHING_TASKBAR_NOTIFICATION") // find a everything search window #define EVERYTHING_IPC_SEARCH_WNDCLASS TEXT("EVERYTHING") // this global window message is sent to all top level windows when everything starts. #define EVERYTHING_IPC_CREATED TEXT("EVERYTHING_IPC_CREATED") // search flags for querys #define EVERYTHING_IPC_MATCHCASE 0x00000001 // match case #define EVERYTHING_IPC_MATCHWHOLEWORD 0x00000002 // match whole word #define EVERYTHING_IPC_MATCHPATH 0x00000004 // include paths in search #define EVERYTHING_IPC_REGEX 0x00000008 // enable regex // item flags #define EVERYTHING_IPC_FOLDER 0x00000001 // The item is a folder. (its a file if not set) #define EVERYTHING_IPC_DRIVE 0x00000002 // The folder is a drive. Path will be an empty string. // (will also have the folder bit set) // the WM_COPYDATA message for a query. #define EVERYTHING_IPC_COPYDATAQUERYA 1 #define EVERYTHING_IPC_COPYDATAQUERYW 2 // all results #define EVERYTHING_IPC_ALLRESULTS 0xFFFFFFFF // all results // macro to get the filename of an item #define EVERYTHING_IPC_ITEMFILENAMEA(list,item) (CHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMA *)(item))->filename_offset) #define EVERYTHING_IPC_ITEMFILENAMEW(list,item) (WCHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMW *)(item))->filename_offset) // macro to get the path of an item #define EVERYTHING_IPC_ITEMPATHA(list,item) (CHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMW *)(item))->path_offset) #define EVERYTHING_IPC_ITEMPATHW(list,item) (WCHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMW *)(item))->path_offset) // // Varible sized query struct sent to everything. // // sent in the form of a WM_COPYDAYA message with EVERYTHING_IPC_COPYDATAQUERY as the // dwData member in the COPYDATASTRUCT struct. // set the lpData member of the COPYDATASTRUCT struct to point to your EVERYTHING_IPC_QUERY struct. // set the cbData member of the COPYDATASTRUCT struct to the size of the // EVERYTHING_IPC_QUERY struct minus the size of a CHAR plus the length of the search string in bytes plus // one CHAR for the null terminator. // // NOTE: to determine the size of this structure use // ASCII: sizeof(EVERYTHING_IPC_QUERYA) - sizeof(CHAR) + strlen(search_string)*sizeof(CHAR) + sizeof(CHAR) // UNICODE: sizeof(EVERYTHING_IPC_QUERYW) - sizeof(WCHAR) + wcslen(search_string)*sizeof(WCHAR) + sizeof(WCHAR) // // NOTE: Everything will only do one query per window. // Sending another query when a query has not completed // will cancel the old query and start the new one. // // Everything will send the results to the reply_hwnd in the form of a // WM_COPYDAYA message with the dwData value you specify. // // Everything will return TRUE if successful. // returns FALSE if not supported. // // If you query with EVERYTHING_IPC_COPYDATAQUERYW, the results sent from Everything will be Unicode. // typedef struct EVERYTHING_IPC_QUERYW { // the window that will receive the new results. HWND reply_hwnd; // the value to set the dwData member in the COPYDATASTRUCT struct // sent by Everything when the query is complete. ULONG_PTR reply_copydata_message; // search flags (see EVERYTHING_MATCHCASE | EVERYTHING_MATCHWHOLEWORD | EVERYTHING_MATCHPATH) DWORD search_flags; // only return results after 'offset' results (0 to return the first result) // useful for scrollable lists DWORD offset; // the number of results to return // zero to return no results // EVERYTHING_IPC_ALLRESULTS to return ALL results DWORD max_results; // null terminated string. arbitrary sized search_string buffer. WCHAR search_string[1]; }EVERYTHING_IPC_QUERYW; // ASCII version typedef struct EVERYTHING_IPC_QUERYA { // the window that will receive the new results. HWND reply_hwnd; // the value to set the dwData member in the COPYDATASTRUCT struct // sent by Everything when the query is complete. ULONG_PTR reply_copydata_message; // search flags (see EVERYTHING_MATCHCASE | EVERYTHING_MATCHWHOLEWORD | EVERYTHING_MATCHPATH) DWORD search_flags; // only return results after 'offset' results (0 to return the first result) // useful for scrollable lists DWORD offset; // the number of results to return // zero to return no results // EVERYTHING_IPC_ALLRESULTS to return ALL results DWORD max_results; // null terminated string. arbitrary sized search_string buffer. CHAR search_string[1]; }EVERYTHING_IPC_QUERYA; // // Varible sized result list struct received from Everything. // // Sent in the form of a WM_COPYDATA message to the hwnd specifed in the // EVERYTHING_IPC_QUERY struct. // the dwData member of the COPYDATASTRUCT struct will match the sent // reply_copydata_message member in the EVERYTHING_IPC_QUERY struct. // // make a copy of the data before returning. // // return TRUE if you processed the WM_COPYDATA message. // typedef struct EVERYTHING_IPC_ITEMW { // item flags DWORD flags; // The offset of the filename from the beginning of the list structure. // (wchar_t *)((char *)everything_list + everythinglist->name_offset) DWORD filename_offset; // The offset of the filename from the beginning of the list structure. // (wchar_t *)((char *)everything_list + everythinglist->path_offset) DWORD path_offset; }EVERYTHING_IPC_ITEMW; typedef struct EVERYTHING_IPC_ITEMA { // item flags DWORD flags; // The offset of the filename from the beginning of the list structure. // (char *)((char *)everything_list + everythinglist->name_offset) DWORD filename_offset; // The offset of the filename from the beginning of the list structure. // (char *)((char *)everything_list + everythinglist->path_offset) DWORD path_offset; }EVERYTHING_IPC_ITEMA; typedef struct EVERYTHING_IPC_LISTW { // the total number of folders found. DWORD totfolders; // the total number of files found. DWORD totfiles; // totfolders + totfiles DWORD totitems; // the number of folders available. DWORD numfolders; // the number of files available. DWORD numfiles; // the number of items available. DWORD numitems; // index offset of the first result in the item list. DWORD offset; // arbitrary sized item list. // use numitems to determine the actual number of items available. EVERYTHING_IPC_ITEMW items[1]; }EVERYTHING_IPC_LISTW; typedef struct EVERYTHING_IPC_LISTA { // the total number of folders found. DWORD totfolders; // the total number of files found. DWORD totfiles; // totfolders + totfiles DWORD totitems; // the number of folders available. DWORD numfolders; // the number of files available. DWORD numfiles; // the number of items available. DWORD numitems; // index offset of the first result in the item list. DWORD offset; // arbitrary sized item list. // use numitems to determine the actual number of items available. EVERYTHING_IPC_ITEMA items[1]; }EVERYTHING_IPC_LISTA; #ifdef UNICODE #define EVERYTHING_IPC_COPYDATAQUERY EVERYTHING_IPC_COPYDATAQUERYW #define EVERYTHING_IPC_ITEMFILENAME EVERYTHING_IPC_ITEMFILENAMEW #define EVERYTHING_IPC_ITEMPATH EVERYTHING_IPC_ITEMPATHW #define EVERYTHING_IPC_QUERY EVERYTHING_IPC_QUERYW #define EVERYTHING_IPC_ITEM EVERYTHING_IPC_ITEMW #define EVERYTHING_IPC_LIST EVERYTHING_IPC_LISTW #else #define EVERYTHING_IPC_COPYDATAQUERY EVERYTHING_IPC_COPYDATAQUERYA #define EVERYTHING_IPC_ITEMFILENAME EVERYTHING_IPC_ITEMFILENAMEA #define EVERYTHING_IPC_ITEMPATH EVERYTHING_IPC_ITEMPATHA #define EVERYTHING_IPC_QUERY EVERYTHING_IPC_QUERYA #define EVERYTHING_IPC_ITEM EVERYTHING_IPC_ITEMA #define EVERYTHING_IPC_LIST EVERYTHING_IPC_LISTA #endif // restore packing #pragma pack(pop) // end extern C #ifdef __cplusplus } #endif #endif // _EVERYTHING_H_ so, the reason for this posting is: it can be implemented in AutoIt3 
      I personally can run es.exe and get the results from the command line, that is I, with my knowing, now, some of you can make a beautiful UDF ( and I say some of you, because, I would not know where to start  )
      I use everything for everything, very handy tool. If you ever get to see it work, you'll see how handy it is, mostly if you have many terabytes of files ( or just plain can't remember where a file is at )
    • clariceo0
      By clariceo0
      Recently, I am interested to build a windows app to reset Windows login password as a side off project. I am still a newbie in programming so i am not able to build the app from scratch. Is there any open source  project i could learn from on this?