Skocz do zawartości

Duckling

Członkowie
  • Postów

    0
  • Dołączył

  • Ostatnio

    Nigdy

Posty napisane przez Duckling

  1. jesli juz chcesz pisac tak jak Spoon to uzyj lstrcpy() - zawsze exe bedzie troche mniejsze

    ale ja polecam moja metode bo po co konstruktorze wywolywac strcpy (albo lstrcpy) za kazdym razem jak jest tworzony obiekt kiedy mozna to zrobic raz :)

  2. 2.
    - jesli chodzi o puste okienko to pod Visual C++ da sie wycisnac 2KB
    - jesli chodzi o MinGW to u mnie puste okno wychodzi 4KB (wersja 2.9.5 - np razem z pakietem Dev-C++ v. 4.9.6.0)

    ja bym Ci polecil taki zestaw:
    najnowszy Dev-C++ (v. 4.9.8.7) i do tego mingw 3.3.1 (niestety nie jest jak na razie dostarczany wraz z Dev-C++)
    w takim zestawie puste okno zajmuje zdaje sie 6KB

    pozniej mozna to spakowac upx-em - duze programy lub FSG - bezkonkurencyjny do pakowania malych programow

    (w programie ktory pisze teraz, do czasu kiedy po kompilacji otrzymywalem rozmiar exe mniejszy niz do 55 KB wygrywal FSG)

  3. najprostsze i najszybsze rozwiazanie to zastosowanie zmiennych wspoldzielonych przez rozne instancje tej samej aplikacji

    ...

    // deklarujemy zmienna wspoldzielona
    int extra_global __attribute__ ((section ("Shared"), shared)) = 0 ;

    ...

    int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance,
    LPSTR lpszArgument, int nFunsterStil)
    {

    if (extra_global == 0)
    {
    extra_global = extra_global + 1 ;
    }
    else
    return 0 ;

    // na koniec zmniejszamy licznik
    extra_global-- ;

    return messages.wParam;
    }

  4. ok, znalazlem co chcialem, rozwiazaniem jest jedna linijka:
    int extra_global __attribute__ ((section ("Shared"), shared)) = 0 ;

    wymagalo to uaktualnienia gcc w Dev-C++ do 3.3.1
    a wszystko dziala elegancko

  5. 1)
    uzywaj CreateDialog a nie Dialogbox
    2)
    nie bardzo wiem o co chodzi
    3)

    int i = SendMessage(hListBox, LB_GETCOUNT, 0, 0) ;
    if (i == LB_ERR)
      return 0 ;
    for (int j = 0 ; j < i ; j++)
    {
      SendMessage(hListBox, LB_GETTEXT, (WPARAM) j, (LPARAM) bufor) ;
      ZapiszDoPliku(bufor) ;
    }
  6. https://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/ifaces/ishelllink/ishelllink.asp

    nie chce mi sie u siebie sprawdzac ale na dole masz napisane co trzeba dolaczyc zeby to poszlo

  7. jak żywcem to żywcem :)

    The CreateLink function in the following example creates a shortcut. The parameters include a pointer to the name of the file to link to, a pointer to the name of the shortcut that you are creating, and a pointer to the description of the link. The description consists of the string, "Shortcut to filename," where filename is the name of the file to link to.

    Because CreateLink calls the CoCreateInstance function, it is assumed that the CoInitialize function has already been called. CreateLink uses the IPersistFile interface to save the shortcut and the IShellLink interface to store the filename and description.

    // CreateLink - uses the shell's IShellLink and IPersistFile interfaces
    // to create and store a shortcut to the specified object.
    // Returns the result of calling the member functions of the interfaces.
    // lpszPathObj - address of a buffer containing the path of the object
    // lpszPathLink - address of a buffer containing the path where the
    // shell link is to be stored
    // lpszDesc - address of a buffer containing the description of the
    // shell link

    HRESULT CreateLink(LPCSTR lpszPathObj,
    LPSTR lpszPathLink, LPSTR lpszDesc)
    {
    HRESULT hres;
    IShellLink* psl;

    // Get a pointer to the IShellLink interface.
    hres = CoCreateInstance(&CLSID_ShellLink, NULL,
    CLSCTX_INPROC_SERVER, &IID_IShellLink, &psl);
    if (SUCCEEDED(hres)) {
    IPersistFile* ppf;

    // Set the path to the shortcut target, and add the
    // description.
    psl->lpVtbl->SetPath(psl, lpszPathObj);

    psl->lpVtbl->SetDescription(psl, lpszDesc);

    // Query IShellLink for the IPersistFile interface for saving the
    // shortcut in persistent storage.
    hres = psl->lpVtbl->QueryInterface(psl, &IID_IPersistFile,
    &ppf);

    if (SUCCEEDED(hres)) {
    WORD wsz[MAX_PATH];

    // Ensure that the string is ANSI.
    MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1,
    wsz, MAX_PATH);

    // Save the link by calling IPersistFile::Save.
    hres = ppf->lpVtbl->Save(ppf, wsz, TRUE);
    ppf->lpVtbl->Release(ppf);
    }
    psl->lpVtbl->Release(psl);
    }
    return hres;
    }

  8. nie chce byc wredny ale temat ten - mimo ze forum jest jak na razie malo popularne - walkowany jest od dawna
    wystarczy przejrzec wczesniejsze posty - znalezienie odpowiedzi zajmie Ci pewnie mniej niz minute :)

  9. witam

    deklaruje sobie wskaznik na funkcje

    typedef int (* FunkcjaF) () ;

    mam tez klase:

    class Klasa
    {
    public:
    int FunkcjaWKlasie() ;
    private:
    int DanaPrywatna ;
    } ;

    mam obiekt tej klasy:

    Klasa obiektKlasy ;

    i wskaznik na funkcje:

    FunkcjaF wskaznikNaFunkcje ;

    i teraz jesli chce sie wywolac funkcje FunkcjaWKlasie to moge to zrobic tak

    obiektKlasy.FunkcjaWKlasie() ;

    a to co chcialbym zrobic to wywolac te funkcje przez wskaznik na funkcje - domyslam sie ze to niemozliwe ale moze jest jakis trik ktory pozwala zrobic cos takiego:

    wskaznikNaFunkcje = &obiektKlasy.FunkcjaWKlasie() ;
    wskaznikNaFunkcje() ;

    powyzszy zapis jest oczywiscie bledny ale czy jest jakis sposob w ktory mozna to osiagnac?

  10. aa jeszcze mi sie przypomnial pewien polski paker
    FSG dostepny tu:
    https://www.xtreeme.prv.pl/

    ale to tylko do malych exekow - ponizej kilkudziesieciu KB - przy wiekszych programach wygrywa UPX
    wada tego FSG jest tez to ze nie pakuje DLL, co potrafi UPX

  11. biały napisał:
    mistyk9001 napisał:
    plusem pakowania jest tez fakt ze pliki sie szybciej uruchamiaja

    hmmm :o
    Dziwne mi sie to wydaje. Zawsze myślałem, że jak jest coś spakowane, to musi się rozpakować przed uruchomieniem. A jak wiadomo takie rozpakowanie zajmuje odrobinkę czasu. Czyli teoretycznie rozpakowanie+uruchomienie programu spakowanego powinno zajmowac wiecej czasu niz samo uruchomienie sie programu niespakowanego. (Co prawda na stronie UPXa napisane jest, ze czas rozpakowania programu jest znikomo mały, ale mimo wszystko...)
    Czy to było napisane z ironią, a ja nie zrozumiałem? :?
    Jeżeli nie, to wytłumacz mi, proszę, ten mechanizm.

    pominałes jedna istotna sprawe
    pliki zajmuja znacznie mniej miejsca po spakowaniu (mniej wiecej 70% mniej - dla programow na ktorych to sprawdzalem)
    odczyt z dysku jest bardzo wolny w porownaniu z czasem jaki potrzeba na zdekodowanie tego pliku - i to caly mechanizm :)
    zreszta proponuje sobie cos spakowac i sprawdzic - widac golym okiem szczegolnie na starszych komputerach

×
×
  • Utwórz nowe...