<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>WinAPI :: 태그 :: 모두의프린터</title><link>https://modu-print.com/tags/winapi/</link><description/><generator>Hugo</generator><language>ko-KR</language><lastBuildDate>Sat, 05 Aug 2023 09:10:00 +0900</lastBuildDate><atom:link href="https://modu-print.com/tags/winapi/index.xml" rel="self" type="application/rss+xml"/><item><title>윈도 프로그래밍시 파일 Dialog에서 네트워크 드라이브 표시 안될경우</title><link>https://modu-print.com/posts/3861/</link><pubDate>Thu, 07 Oct 2021 13:13:00 +0900</pubDate><guid>https://modu-print.com/posts/3861/</guid><description>개발 언어관련된 부분은 아니지만 .. 이글 하나 때문에 카테고리를 추가하기도 좀 그래서 WinAPI 관련으로 보고 이 카테고리에 적어봅니다.&#10;윈도 비스타 이후에 UAC라는 사용자 계정 컨트롤이라는 개념이 생기고 로그인 권한이나 세션권한이 고도화 되면서 발생하는 부작용? 같은거라고 보면 되겠으나 ...&#10;하여튼간에 ;; &#10;이런식으로 파일 선택 기능에 네트워크 드라이브가 표시가 될것이라 생각하지만 .. 안보이는 경우가 생길겁니다.</description></item><item><title>CreateProcessAsUser - 서비스에서 GUI포함한 프로그램 실행</title><link>https://modu-print.com/posts/3870/</link><pubDate>Mon, 21 Jun 2021 13:22:00 +0900</pubDate><guid>https://modu-print.com/posts/3870/</guid><description>일반적으로 윈서 서비스 프로그램은 일반 어플리케이션과 다른 영역에서 실행되기 때문에.. 서비스가 SheelExecute나 CreateProcess 함수등으로 실행한 프로그램들은 GUI를 포함하고 있다하더라도 화면에 표시되지 않습니다.&#10;이러한 이유로 서비스 프로세스에서 .. GUI를 포함한 프로그램을 실행하려 하는 경우에는 ..&#10;CreateProcessAsUser 함수를 통해서 실행을 해줘야 합니다.&#10;이떄 사용가능한 함수인데요..&#10;이 함수 인자가 2개인데요 szExeName, lpCommandLine 2개인데 ..</description></item><item><title>ShellExcute - 프로세스 종료까지 대기</title><link>https://modu-print.com/posts/3868/</link><pubDate>Mon, 21 Jun 2021 13:20:00 +0900</pubDate><guid>https://modu-print.com/posts/3868/</guid><description>MFC나 API 에서 외부 실행파일을 실행하는데 가장 많이쓰는게 ShellExcute 인데요 .. 간혹 .. 실행시킨 프로세스가 종료될때까지 대기해야 하는경우가 있습니다 그런때 사용하면 됩니다.&#10;C++ ::ZeroMemory(&amp;sei, sizeof(SHELLEXECUTEINFO)); sei.cbSize = sizeof(SHELLEXECUTEINFO); sei.lpFile = ("실행파일"); sei.lpDirectory = ("실행경로"); sei.lpParameters = _T("실행인자"); sei.nShow = SW_HIDE; sei.fMask = SEE_MASK_NOCLOSEPROCESS; sei.lpVerb = _T("open"); DWORD result = ::ShellExecuteEx(&amp;sei); if (sei.hProcess != NULL) { // 프로세스 종료까지 대기 WaitForSingleObject(sei.hProcess, INFINITE); }</description></item><item><title>Go언어로 윈도 서비스 어플리케이션 만들기</title><link>https://modu-print.com/posts/3881/</link><pubDate>Fri, 23 Apr 2021 13:32:00 +0900</pubDate><guid>https://modu-print.com/posts/3881/</guid><description>최근에는 MS의 Visual Studio도 기본적으로 무료로 사용가능하지만.. 무료버전으로는 서비스 어플리케이션은 개발할 수가 없습니다. ( 물론 Professional 버전 등에서 관련 리소스들을 복사해와서 꼼수로 개발환경을 구성가능하기도 하지만 ㅎㅎ )&#10;여튼 ..&#10;Go로도 윈도 서비스 어플리케이션 개발이 가능합니다.&#10;example command - golang.org/x/sys/windows/svc/example - Go Packages Example service program that beeps. 참고하시면 되겠습니다 ㅎ</description></item><item><title>윈도 API를 이용한 wav 사운드 파일 재생</title><link>https://modu-print.com/posts/3911/</link><pubDate>Fri, 09 Apr 2021 16:11:00 +0900</pubDate><guid>https://modu-print.com/posts/3911/</guid><description>간단히 소리로 무언가를 알려야 할경우에 유용한 코드입니다. 구글링 중에 얻은 코드인지 깃헙 돌아다니다 발췌한 코드인지 기억이 가물가물해서 출처가 애매하네요 ;; &#10;Go package main import ( "syscall" "unsafe" ) const ( SND_SYNC uint = 0x0000 /* play synchronously (default) / SND_ASYNC uint = 0x0001 / play asynchronously / SND_NODEFAULT uint = 0x0002 / silence (!default) if sound not found / SND_MEMORY uint = 0x0004 / pszSound points to a memory file / SND_LOOP uint = 0x0008 / loop the sound until next sndPlaySound / SND_NOSTOP uint = 0x0010 / don't stop any currently playing sound / SND_NOWAIT uint = 0x00002000 / don't wait if the driver is busy / SND_ALIAS uint = 0x00010000 / name is a registry alias / SND_ALIAS_ID uint = 0x00110000 / alias is a predefined ID / SND_FILENAME uint = 0x00020000 / name is file name / SND_RESOURCE uint = 0x00040004 / name is resource name or atom / SND_PURGE uint = 0x0040 / purge non-static events for task / SND_APPLICATION uint = 0x0080 / look for application specific association / SND_SENTRY uint = 0x00080000 / Generate a SoundSentry event with this sound / SND_RING uint = 0x00100000 / Treat this as a "ring" from a communications app - don't duck me / SND_SYSTEM uint = 0x00200000 / Treat this as a system sound / SND_ALIAS_START uint = 0 / alias base */ ) var ( mmsystem = syscall.MustLoadDLL("winmm.dll") playSound = mmsystem.MustFindProc("PlaySound") sndPlaySoundA = mmsystem.MustFindProc("sndPlaySoundA") sndPlaySoundW = mmsystem.MustFindProc("sndPlaySoundW") ) // PlaySound play sound in Windows func PlaySound(sound string, hmod int, flags uint) { if playSound == nil { return } s16, := syscall.UTF16PtrFromString(sound) playSound.Call(uintptr(unsafe.Pointer(s16)), uintptr(hmod), uintptr(flags)) } // SndPlaySoundA play sound file in Windows func SndPlaySoundA(sound string, flags uint) { if sndPlaySoundA == nil { return } b := append([]byte(sound), 0) sndPlaySoundA.Call(uintptr(unsafe.Pointer(&amp;b[0])), uintptr(flags)) } // SndPlaySoundW play sound file in Windows func SndPlaySoundW(sound string, flags uint) { if SndPlaySoundW == nil { return } s16, := syscall.UTF16PtrFromString(sound) sndPlaySoundW.Call(uintptr(unsafe.Pointer(s16)), uintptr(flags)) }</description></item><item><title>MS윈도 파일또는 폴더를 휴지통으로 버리기</title><link>https://modu-print.com/posts/3898/</link><pubDate>Fri, 09 Apr 2021 16:01:00 +0900</pubDate><guid>https://modu-print.com/posts/3898/</guid><description>윈도에서 프로그래밍을 하다보면 파일을 바로 삭제하는게 아닌 휴지통으로 이동시켜야 하는 경우가 생깁니다. os.Remove 같은 메소드를 이용하여 파일자체를 영구 삭제하는거야 매우 편하지만 ..&#10;사용자를 대상으로 배포할 프로그램을 만드는 경우에는 가능하면 사용자의 실수도 감안하여 바로 삭제하는게 아닌 휴지통으로 이동을 시켜야 할 경우가 생깁니다.&#10;이는 Go언어가 아닌 MFC나 Win32 API를 가지고 개발을 하더라도 결국 MS에서 제공하는 시스템 함수를 가지고서 다뤄야 하는 문제라 ..</description></item><item><title>윈도 API를 이용한 중복실행방지 ( feat. mutex )</title><link>https://modu-print.com/posts/3924/</link><pubDate>Thu, 08 Apr 2021 16:19:00 +0900</pubDate><guid>https://modu-print.com/posts/3924/</guid><description>윈도용 프로그램을 Go로 개발하다보면 중복실행을 원치 않을 경우가 있습니다. 이런때 윈도 API 의 뮤텍스 관련 함수를 이용하면 같은 프로그램의 중복실행을 방지할 수 있습니다.&#10;Bash go get github.com/rodolfoag/gow32 위 패키지 설치가 필요합니다.</description></item><item><title>윈도 서비스 컨트롤</title><link>https://modu-print.com/posts/3914/</link><pubDate>Thu, 08 Apr 2021 16:13:00 +0900</pubDate><guid>https://modu-print.com/posts/3914/</guid><description>윈도의 실행중인 여러 서비스를 중지시키거나 실행시키거나 하는 .. 서비스를 컨트롤 하는 함수입니다.&#10;모두의 프린터를 만들면서 사용한 코드입니다.&#10;Bash go get golang.org/x/sys/windows/svc go get golang.org/x/sys/windows/svc/mgr 이 두놈이 필요하구요 go get .. 고고</description></item></channel></rss>