顯示包含「Windows」標籤的文章。顯示所有文章
顯示包含「Windows」標籤的文章。顯示所有文章

2026年8月5日星期三

Use Powershell command to backup/restore all docker images

Backup all docker images: 


docker images -q | ForEach-Object { &docker save -o "$_.tar" $_ }


Restore all images:


ls -name *.tar | ForEach-Object { &docker load -i $_ }


2013年2月4日星期一

將一個小型 Qt5 Win32 (MSVC 版本) 程序放到另一台電腦上

要將一個小型 Qt5 Win32 (MSVC 版本) 程序放到另一台電腦上執行, 除了程序本身外, 我們也需要複製以下 DLL:

icudt49.dll (在 ICU 49 套件內)
icuin49.dll (在 ICU 49 套件內)
icuuc49.dll (在 ICU 49 套件內)
libEGL(d).dll (在 Qt5 的資料夾內的 msvc2010\lib 內)
libGLESv2(d).dll (在 Qt5 的資料夾內的 msvc2010\lib 內)
msvcp100(d).dll (在 Windows 的 System32 內)
msvcr100(d).dll (在 Windows 的 System32 內)
Qt5Core(d).dll (在 Qt5 的資料夾內的 msvc2010\lib 內)
Qt5Gui(d).dll (在 Qt5 的資料夾內的 msvc2010\lib 內)
Qt5Widgets(d).dll (在 Qt5 的資料夾內的 msvc2010\lib 內)
/platforms/qminimal(d).dll (在 Qt5 的資料夾內的 msvc2010\plugins\platforms 內)
/platforms/qwindows(d).dll (在 Qt5 的資料夾內的 msvc2010\plugins\platforms 內)

(d) 代表 debug 版本

留意 qminimal 和 qwindows 必須放在 platforms 子資料夾內, 否則程序會報錯.

安裝 Qt5 for Win32 (MSVC 2010 版本)

在安裝 Qt5 for Windows 32 bit (VS 2010 Version) 之前, 我們需要先安裝以下軟件:

1. Microsoft Visual C++ Express 2010
在這裡下載 Microsoft Visual C++ Express 2010 並安裝, 然後再安裝有關 Patch 和 Service Pack.
因為我們需要 VC++ 的 Compiler 和 Linker.

2. Windows Software Development Kit (SDK)
在這裡下載 Windows SDK, 然後安裝有關 Debugger (CDB) 的軟件

3. 由於 Qt Core 會用 ICU 的 DLL, 如果你需要將你的程序放到其他電腦上執行的話, 那麼請下載 IUC 49 套件.

4. 完成上面的步驟後便可以安裝 Qt5 for Windows (VS 2010) 了

5. 當然, 如果你需要將你的程序放到其他電腦上執行的話, Dependency Walker 一定少不了


[轉貼] How can an MSVC program call an MinGW DLL, and vice versa?

轉貼一個在 Windows 32 platform 下用 MinGW 和 MS VC DLL 的技巧
原文

Q. How can an MSVC program call an MinGW DLL, and vice versa?
A. Assume we have a testdll.h, testdll.c, and testmain.c. In the first case, we will compile testdll.c with MinGW, and let the MSVC-compiled testmain call it. You should use
gcc -shared -o testdll.dll testdll.c \
    -Wl,--output-def,testdll.def,--out-implib,libtestdll.a
to produce the DLL and DEF files. MSVC cannot use the MinGW library, but since you have already the DEF file you may easily produce one by the Microsoft LIB tool:
lib /machine:i386 /def:testdll.def
Once you have testdll.lib, it is trivial to produce the executable with MSVC:
cl testmain.c testdll.lib
Now for MinGW programs calling an MSVC DLL. We have two methods. One way is to specify the LIB files directly on the command line after the main program (in newer MinGW versions; MinGW GCC 2.95.2 is reported not to work). For example, after
cl /LD testdll.c
use
gcc -o testmain testmain.c testdll.lib
The other way is to produce the .a files for GCC. For __cdecl functions (in most cases), it is simple: you only need to apply the reimp tool (the original site is unavailable now, but you may download here a version enhanced by José Fonseca):
reimp testdll.lib
gcc -o testmain testmain.c -L. -ltestdll
However, the above method does not work with __stdcall functions. For MSVC will prefix an underscore to __stdcall functions while MinGW will not. The right way is to produce the DEF file using the pexports tool (downloadable here if not found elsewhere) and filter off the first underscore by sed:
pexports testdll.dll | sed "s/^_//" > testdll.def
Then, when using dlltool to produce the import library, add `-U' to the command line:
dlltool -U -d testdll.def -l libtestdll.a
And now, you can proceed in the usual way:
gcc -o testmain testmain.c -L. -ltestdll
Hooray, we got it. And that is the end of this FAQ.
2001-12-21, written by Wu Yongwei
2004-7-29, last revised by Wu Yongwei

2008年10月11日星期六

找出執行程式的檔案路徑 (Linux 和 Windows 版本)

#include "string.h"
#include "stdio.h"

#ifndef __WIN32__
#include "unistd.h"
#include "sys/types.h"
#endif

char getApplicationPath(char *pPath, int nMaxPathSize)
{
char proc_path[20], buf[256], *lastchar;
int len;

#ifdef __WIN32__
len = GetModuleFileName(NULL, buf, 256);

if(len == 0) {
// GetModuleFileName error
return -1;
}

if((len >= 256) || (len >= nMaxPathSize)) {
//insufficient size
return -2;
}

// terminate the returned string first
buf[len] = 0;

// then remove the application name
lastchar = strrchr(buf, '\\');
#else
sprintf(proc_path, "/proc/%d/exe", getpid());
len = readlink(proc_path, buf, 256);

if(ret < 0) {
// readlink error
perror("readlink");
return -1;
}

if((len >= 256) || (len >= nMaxPathSize)) {
// insufficient size
return -2;
}

// terminate the returned string first
buf[len] = 0;

// then remove the application name
lastchar = strrchr(buf, '/');
#endif

if(lastchar != NULL) {
*lastchar = 0;
} else {
// application name not found
return -3;
}

strcpy(pPath, buf);

// success
return 0;
}

2008年3月16日星期日

好用的免費 Windows 軟件:

1. TinyPDF
用來上產生 PDF 檔案

2.CamStudio
用來錄製桌面動態影像軟體,最好的應用就是軟體使用教學的製作.

2007年7月7日星期六

KPlayer

今天為了看 MKV 的檔案, 在網上找找有什麼好的播放軟件. 結果找到一個叫 KPlayer 的軟件.
安裝和使用後發覺不錯啊, 雖然是韓國軟件, 但有中文介面.

Win32 EXE 下載連結:
KPlayer.exe