4 pagesV  1 2 3 4 > »  
 
REPLY
> Some sources.
-QwertY-
Message#1
17.10.05, 21:33
Social network? No, have not heard!
*********
[offline]

Group: Admins
Messages 4970
Check in: 12.08.06

Reputation:-  0  +

����� ����� ����������� �������� ���� ����� ��������, ������� � �.�.
�� ��� ������ ����-�����...
download

-QwertY-
Message#2
17.10.05, 21:35
Social network? No, have not heard!
*********
[offline]

Group: Admins
Messages 4970
Check in: 12.08.06

Reputation:-  0  +

And immediately from me the source of my programBTOnOff. I think many will be useful ...

// enable standard type and function definitions
#include

// Create a simple replacement of the function, so as not to write every time such
// long string
#define MsgBox (text) (MessageBox (NULL, text, L "BT-WLAN Utils", MB_OK | MB_ICONEXCLAMATION))

//==========================
// Paths to the sound files
WCHAR SoundOn [256];
WCHAR SoundOff [256];
//==========================

// I don’t need comments. This is the only function.
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE, unsigned short * lpCmdLine, int)
{

// We are looking for the BT manager window
HWND bt_hwnd = FindWindow (L "WCE_BTTRAY", 0);
if (! bt_hwnd) {
// If we don’t find a window, then we say that we can’t work with BT
MsgBox (L "Could not find Bluetooth manager");
// exit function and program respectively
return 0;
}

// create a handle for the file.
HANDLE hFile = NULL;
// We are looking for somewhere located on the PDA prog BTOnOff
GetModuleFileName ((HMODULE) (hInst, SoundOn, 256);
// Select only the path to the folder with the program
wcscpy (SoundOn, wcsrev (wcsstr (wcsrev (SoundOn), L "\\")));
// append the path from SoundOn to SoundOff
wcscpy (SoundOff, SoundOn);
// Enter the name of the include sound file in SoundOn.
wcscat (SoundOn, L "SoundOn.wav");
wcscat (SoundOff, L "SoundOff.wav"); // By analogy (see above)

//=======================
// See if there is a SoundOn file.
hFile = CreateFile (SoundOn, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
// If there is no SoundOn file, then enter an empty string. Type halyard no.
wcscpy (SoundOn, L "");
}
CloseHandle (hFile);
//=======================

// Similar to the above for SoundOff
hFile = CreateFile (SoundOff, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
// If there is no SoundOff file, but there is a SoundOn, then we use SoundOn and to indicate the cutting down of the BT
if (wcscmp (SoundOn, L ""))
wcscpy (SoundOff, SoundOn);
else
wcscpy (SoundOff, L "");
}
CloseHandle (hFile);

// Register messages for the BT manager window
UINT WIDCOMM_WM_BTRADIO_ON = RegisterWindowMessage (L "WIDCOMM_WM_BTRADIO_ON");
UINT WIDCOMM_WM_BTRADIO_OFF = RegisterWindowMessage (L "WIDCOMM_WM_BTRADIO_OFF");
UINT WIDCOMM_WM_GET_BTRADIO = RegisterWindowMessage (L "WIDCOMM_WM_GETSTACKSTATUS");

// Find out the current status of BT. At random I already found out. 4 this
//switched off...
int status = (int) SendMessage (bt_hwnd, WIDCOMM_WM_GET_BTRADIO, 0,0);
if (status == 4) {
// If there is a path to the SoundOn file, then play the melody ..
if (wcscmp (SoundOn, L ""))
PlaySound (SoundOn, 0, SND_FILENAME);
// Turn on BT
SendMessage (bt_hwnd, WIDCOMM_WM_BTRADIO_ON, 0, 0);
}
// If there was a launch of the program without parameters and the BT was turned on then we cut it down.
else if (! wcscmp (lpCmdLine, L "")) {
if (wcscmp (SoundOff, L ""))
PlaySound (SoundOff, 0, SND_FILENAME);
SendMessage (bt_hwnd, WIDCOMM_WM_BTRADIO_OFF, 0, 0);
}

// if the program is run with parameters. those. It is necessary to turn on BT using
// any program, then we start the execution of the program.
if (wcscmp (lpCmdLine, L "")) {
for (int i = 0; i if (lpCmdLine [i] == '\ r') lpCmdLine [i] = '\ 0';
if (lpCmdLine [i] == '\ n') lpCmdLine [i] = '\ 0';
}
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory (& si, sizeof (si));
si.cb = sizeof (si);
ZeroMemory (& pi, sizeof (pi));
// Run the program itself. If the launch failed, we deduce that the program was not found.
if (! CreateProcess (lpCmdLine, lpCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, & si, & pi)) {
MsgBox (L "Can't find execute file.");
� �}
// We are waiting for the end of the program. Then we return the BT to the state
// which was before the launch of the program.
WaitForSingleObject (pi.hProcess, INFINITE);
CloseHandle (pi.hProcess);
CloseHandle (pi.hThread);
if (status == 4) {
if (wcscmp (SoundOff, L ""))
PlaySound (SoundOff, 0, SND_FILENAME);
SendMessage (bt_hwnd, WIDCOMM_WM_BTRADIO_OFF, 0, 0);
}
}
return 0;

}


--------------------
People like me here, people like you here. They don’t go around here, they don’t hide their eyes.Compromise is not for us!
© Alice - Compromise
Winner of the First Prizesavagemessiahzine.comin the nomination of the Hero of the Forum!
Prize winnersavagemessiahzine.comin the nomination "Master'07"
DarkClaus
Message#3
18.10.05, 11:10
Local
*****
[offline]

Group: Friendssavagemessiahzine.com
Messages 182
Check in: 12.10.05
Apple iPhone SE

Reputation:-  14  +

//
// Example of the Plug-In Component
// Draws a black rectangle :)
//
// Taken from msdn.microsoft.com
// Author - John Kennedy (John Kennedy)
//
// Translated and modified DarkClaus for 4da


#include "windows.h"
#include // available on the PPC2003 SDK
#include // __ /

const TCHAR k_szWindowClass] = TEXT ("TodayTest");
HINSTANCE g_hInst = NULL;

// Height of our module in pixels

#define MODULE_HEIGHT 42


/*************************************************************************/
/ * WndProc for window * /
/*************************************************************************/
LRESULT WINAPI CustomItemWndProc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
PAINTSTRUCT ps;
HDC hdc = NULL;

// Structure for storage
// various inside information
// about the Today component.

TODAYLISTITEM * ptli2;
switch (msg)
{

// Changed data and ..
case: (WM_TODAYCUSTOM_CLEARCACHE):
break;

// This event occurs approximately every 2 seconds.
case (WM_TODAYCUSTOM_QUERYREFRESHCACHE):
ptli2 = (struct _TODAYLISTITEM *) wp;

// Note!
if (0 == ptli2-> cyp)
� {
// TRU is returned once
// after setting the height
ptli2-> cyp = MODULE_HEIGHT;
return TRUE;
� }
else
� {
// This thread is usually processed
return FALSE;
� }
break;

// Standard drawing event
case WM_PAINT:
hdc = BeginPaint (hwnd, & ps);
// Quick and rough drawing example
// Draw a black square
BitBlt (hdc, 0,0,240, MODULE_HEIGHT, NULL, 0,0, BLACKNESS);
EndPaint (hwnd, & ps);
break;
�
// Handle the event with a stylus
case WM_LBUTTON:
// there is something :)
break;

default:
break;
� �}
return DefWindowProc (hwnd, msg, wp, lp);
}




/*************************************************************************/
/ * Class initialization * /
/*************************************************************************/
void InitilizeClass (HINSTANCE hinst)
{
WNDCLASS wc;
memset (& wc, 0, sizeof (wc));
wc.style = 0;
wc.lpfnWndProc = (WNDPROC) CustomItemWndProc;
wc.hInstance = hinst;
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = (struct HBRUSH __ *) GetStockObject (WHITE_BRUSH);
wc.lpszClassName = k_szWindowClass;
UnregisterClass (k_szWindowClass, hinst);
RegisterClass (& wc);
}


/*************************************************************************/
/ * Initialize everything that DLLK may need * /
/*************************************************************************/
BOOL WINAPI DllMain (HANDLE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
{
UNREFERENCED_PARAMETER (lpvReserved);
switch (fdwReason)
� �{
case DLL_PROCESS_ATTACH:
g_hInst = (struct HINSTANCE__ *) hDLLInst;
DEBUGREGISTER ((HINSTANCE) hDLLInst);
InitilizeClass ((HINSTANCE) hDLLInst);
break;
case DLL_PROCESS_DETACH:
UnregisterClass (k_szWindowClass, (struct HINSTANCE__ *) hDLLInst);
break;
� �}
return TRUE;
}


// Enter DL:
HWND InitializeCustomItem (TODAYLISTITEM * ptli, HWND hwndParent)
{
Hwnd hwnd;
if (! ptli-> fEnabled)
return NULL;
hWnd = CreateWindow (k_szWindowClass, k_szWindowClass, WS_VISIBLE | WS_CHILD, 0, 0, 0, MODULE_HEIGHT,
hwndParent, NULL, g_hInst, NULL);
ShowWindow (hWnd, SW_SHOWNORMAL);
return hWnd;
}



Here is what you need to register in the registry:
[HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Today \ Items \ VashPlugin \]

Type DWORD 4 If here 4, then the component is not written by Microsoft
Enabled DWORD 1 1 or 0, indicates whether it is active or not.
Options DWORD 1 1 or 0. Put 1 if the plugin has options.
String DLL \ windows \ todaycomponent.dll The path and name of the component DLL.

To edit the registry, I used Resco Explorer Reg-Plugin

Compim this miracle with the help of eVC3.
We throw the DLL in the Windows folder on the PPC.
Further as usual :)
____________________________________


--------------------
psp slim (lasted the longest), htc hero brown (instead of iphone, i like it more), macbook air 1.6 9400M (i love this laptop)
StSlam
Message#4
22.11.05, 12:38
Local
*****
[offline]

Group: Friendssavagemessiahzine.com
Messages 324
Check in: 05.10.05
Samsung Galaxy Note 3 SM-N900

Reputation:-  33  +

Utility (3 kb) to turn off the screen, turn off the device, reboot.
Sources (ZIP) below (including ehe-shnik).

//*****************************************************************************
// Category: Utilities
// Name: ScrnOFF.exe
//
// Description: Screen Off, Shut Down, PPC Restart
// by command line parameters (shortcut)
//
// Examples: create a shortcut to the program and modify
// start line
// was: CF Card \ PROGS \ SYS \ ScrnOFF.exe
// became: "CF Card \ PROGS \ SYS \ ScrnOFF.exe" 1
//*****************************************************************************
// Wednesday: eVC4
// Tested to: iPAQ hx4700
// Model: WCE ARMV4 RELEASE Pocket 2003 SE
// EXE size 3,584 bytes
// Source code: Microfoft
// Alterations: Slam (StSlam)
//*****************************************************************************


// Exclude rarely-used things from Windows headers
#define WIN32_LEAN_AND_MEAN

#include<windows.h>
#include<pm.h>

// some ads that are not in the minimum standard eVC4
// GDI Escapes for ExtEscape ()
#define QUERYESCSUPPORT 8

// The following are unique to CE
#define GETVFRAMEPHYSICAL 6144
#define GETVFRAMELEN 6145
#define DBGDRIVERSTAT 6146
#define SETPOWERMANAGEMENT 6147
#define GETPOWERMANAGEMENT 6148


typedef enum _VIDEO_POWER_STATE {
VideoPowerOn = 1,
VideoPowerStandBy,
VideoPowerSuspend,
VideoPowerOff
} VIDEO_POWER_STATE, * PVIDEO_POWER_STATE;


typedef struct _VIDEO_POWER_MANAGEMENT {
ULONG Length;
ULONG DPMSVersion;
ULONG PowerState;
} VIDEO_POWER_MANAGEMENT, * PVIDEO_POWER_MANAGEMENT;


int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
//Ads
VIDEO_POWER_MANAGEMENT vpm;
HDC gdc;
// Simplified parsing of launch parameters (in this form - 1 character parameter)
switch (lpCmdLine [0])
{
// Turn off the screen
case 0:
case '0':
gdc = :: GetDC (NULL);
vpm.Length = sizeof (VIDEO_POWER_MANAGEMENT);
vpm.DPMSVersion = 0x0001;
vpm.PowerState = VideoPowerOff;
ExtEscape (gdc, SETPOWERMANAGEMENT, vpm.Length, (LPCSTR) & vpm, 0, NULL);
:: ReleaseDC (NULL, gdc);
break;
// Turn off ("sleep") device
case '1':
SetSystemPowerState (NULL, POWER_STATE_SUSPEND, POWER_FORCE);
break;
case '2':
// soft reset request
if (6 == MessageBox (NULL, TEXT ("Reload?"), TEXT ("Warning!"),
MB_YESNO | MB_ICONEXCLAMATION | MB_TOPMOST)
) SetSystemPowerState (NULL, POWER_STATE_RESET, POWER_FORCE);
break;
default:
MessageBox (NULL, TEXT ("Startup options: \ nunless or 0 - turn off the screen \ n1 - turn off the device (sleep) \ n2 - restart (soft reset)"), TEXT ("Usage"),
MB_OK | MB_ICONASTERISK | MB_TOPMOST);
} // endswitch

return 0;
}
<span style = 'display: none'>1 1</ span>

Attached files

Attached fileScrnOFF.zip(12.8 KB)


Post has been edited-QwertY- - 12.06.07, 20:05


--------------------
N900
StSlam
Message#5
30.11.05, 21:22
Local
*****
[offline]

Group: Friendssavagemessiahzine.com
Messages 324
Check in: 05.10.05
Samsung Galaxy Note 3 SM-N900

Reputation:-  33  +

Converting Unicode to a "normal" string and vice versa ... By parameter ... Short ...
(torn from MS example Deferredinstaller)
// convert TCHAR * (or WCHAR) to char *
// usage example
// ... At the entrance we have:
// TCHAR * lptszBuffer ...
// Let's work with the string:
// LPSTR pcharstring = NULL; // char * pcharstring = NULL
// ConvertWCHARToCHAR (lptszBuffer, & pchar);
//... directly work with the Charov line
// don't forget that we have little memory :)
// delete] pcharstring;

HRESULT ConvertWCHARToCHAR (LPWSTR pszwChar, LPSTR * ppszChar)
{
HRESULT hr = S_OK;
INT iRetVal = 0;
// get buffer size
iRetVal = WideCharToMultiByte (CP_ACP, 0, pszwChar, -1, NULL, 0, NULL, NULL);
// insert iRetVa check
// allocate memory
* ppszChar = (LPSTR) new BYTE [iRetVal]; // iRetVal includes Null.
// insert ppszChar check
// transform
iRetVal = WideCharToMultiByte (CP_ACP, 0, pszwChar, -1, * ppszChar, iRetVal, NULL, NULL);
// insert iRetVal check
return hr;
}


// convert char * to TCHAR * (or WCHAR)
HRESULT ConvertCHARToWCHAR (LPSTR pszChar, LPWSTR * ppszwChar)
{
HRESULT hr = S_OK;
INT iRetVal = 0;
// get buffer size
iRetVal = MultiByteToWideChar (CP_ACP, 0, pszChar, -1, NULL, 0);
// insert iRetVal check

// allocate memory
* ppszwChar = (LPWSTR) new WCHAR [iRetVal]; // iRetVal includes Null.
// insert ppszwChar check

// transform
iRetVal = MultiByteToWideChar (CP_ACP, 0, pszChar, -1, * ppszwChar, iRetVal);
// insert iRetVal check
return iRetVal;
}


Post has been edited-QwertY- - 12.06.07, 20:31


--------------------
N900
StSlam
Message#6
01.12.05, 11:39
Local
*****
[offline]

Group: Friendssavagemessiahzine.com
Messages 324
Check in: 05.10.05
Samsung Galaxy Note 3 SM-N900

Reputation:-  33  +

I will share some other ideas:
Class for working with bits. (c) I;)
Rare delicacy.
The code was optimized as best it could (to the detriment of readability), but if anyone can - it will be interesting to see - what else can be optimized.
// hpp
class TBitSet
{
public:
BYTE * Buf; //buffer
int FSize; // number of bytes (buffer, size)
bool GetBit (int index); // get a bit
void SetBit (int index, bool Value); // set the bit
TBitSet (int Count); // constructor, the parameter is the number of bits
~ TBitSet (); // destructor
};
// cpp
//---------------------------------------------------------------------------
bool TBitSet :: GetBit (int index)
{
return (bool) ((Buf [(index >> 3)]) & (0x01 << (index% 8)));
}
//---------------------------------------------------------------------------
// Set the i-th bit
void TBitSet :: SetBit (int index, bool Value)
{
int i;
BYTE bitno;
i = (index >> 3);
bitno = (0x01 << (index% 8));
if (Value)
if (! (Buf [i] & (bitno)))
Buf [i] = Buf [i] | (bitno);
else
if ((Buf [i] & (bitno)))
Buf [i] ^ = (bitno);
}
//---------------------------------------------------------------------------
TBitSet :: TBitSet (int Count)
{
FSize = (Count >> 3) +1; //Dimension. How many bytes
// FCount = FSize << 3; // Maximum number of bits stored
Buf = new BYTE [FSize]; // Pointer to the memory in which the bits are stored
ZeroMemory (Buf, FSize); // Clear Memory
}
//---------------------------------------------------------------------------
TBitSet :: ~ TBitSet (void)
{
delete] Buf; // freeing memory
}
//--------------------------------------------------------------------------


Post has been edited-QwertY- - 12.06.07, 20:31


--------------------
N900
-QwertY-
Message#7
21.01.06, 01:16
Social network? No, have not heard!
*********
[offline]

Group: Admins
Messages 4970
Check in: 12.08.06

Reputation:-  0  +

Slightly more simple function to extinguish the process. The process name is also passed to the function. 3 attempts to put out the process, if unsuccessful, returns FALSE.

BOOL EndProcess (LPWSTR procname)
{
HANDLE hProcessSnap = NULL;
BOOL bRet = FALSE;
PROCESSENTRY32 pe32 = {0};
hProcessSnap = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE)
return (FALSE);
pe32.dwSize = sizeof (PROCESSENTRY32);
if (Process32First (hProcessSnap, & pe32))
� �{
bRet = TRUE;
do
� � � �{
if (! wcscmp (_wcslwr (procname), _ wcslwr (pe32.szExeFile)))
� {
HANDLE hProcess;
hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID); // connection to the process
if (hProcess)
� �{
BOOL TermSucc = FALSE;
for (int i = 0; i <3, TermSucc; i ++) // gives 3 attempts to close
� � {
TermSucc = TerminateProcess (hProcess, 0); // attempt to close
� � }
if (! TermSucc)
� � {
CloseHandle (hProcess); // close handle in case of failure
bRet = FALSE;
� � }
} else {
bRet = FALSE;
� �}
� }
� � � �}
while (Process32Next (hProcessSnap, & pe32));
� �}
else
bRet = FALSE;
CloseToolhelp32Snapshot (hProcessSnap);
return (bRet);
}


Post has been edited-QwertY- - 07.11.08, 11:50


--------------------
People like me here, people like you here. They don’t go around here, they don’t hide their eyes.Compromise is not for us!
© Alice - Compromise
Winner of the First Prizesavagemessiahzine.comin the nomination of the Hero of the Forum!
Prize winnersavagemessiahzine.comin the nomination "Master'07"
Scrat
Message#8
28.01.06, 15:46
Visitor
**
[offline]

Group: Active users
Messages 16
Check in: 12.11.05

Reputation:-  2  +

It is more correct to check the "success" of TerminateProcess as follows:

if (:: GetExitCodeProcess (hProcess, & ExitCode))
{
if (ExitCode! = STILL_ACTIVE)
{
....
}
}
ankazakov
Message#9
17.03.06, 22:34
Local
*****
[offline]

Group: Friendssavagemessiahzine.com
Messages 188
Check in: 09.03.06
HTC Desire SV

Reputation:-  12  +

I liked this forum. I can give several source codes from my practice.
:) "" I'm not a wizard I'm just studying "" :)


// Send SMS

#include
#include
#include
#include

void SendSMS (BOOL bSendConfirmation, LPCTSTR lpszRecipient, LPCTSTR lpszMessage)
{


SMS_HANDLE smshHandle;
SMS_ADDRESS smsaDestination;
static TEXT_PROVIDER_SPECIFIC_DATA tpsd;
SMS_MESSAGE_ID smsmidMessageID;


LoopS:
// try to open an SMS Handle
if (FAILED (SmsOpen (SMS_MSGTYPE_TEXT, SMS_MODE_SEND, & smshHandle, NULL)))
{
// MessageBox (NULL, TEXT ("I can not open the SMS handle")), TEXT ("Error !!!"), MB_OK | MB_ICONERROR);
// return;
�
Sleep (50);
goto LoopS;
}
�
stop:
// Create the destination address
smsaDestination.smsatAddressType = SMSAT_INTERNATIONAL;
_tcsncpy (smsaDestination.ptsAddress, lpszRecipient, SMS_MAX_ADDRESS_LENGTH);

// Set up provider specific data
tpsd.dwMessageOptions = bSendConfirmation? PS_MESSAGE_OPTION_STATUSREPORT: PS_MESSAGE_OPTION_NONE;
tpsd.psMessageClass = PS_MESSAGE_CLASS1;
tpsd.psReplaceOption = PSRO_NONE;
tpsd.dwHeaderDataSize = 0;

SmsSendMessage (smshHandle, // 1
Null // 2
& smsaDestination, // 3
Null // 4
(PBYTE) lpszMessage, // 5
_tcslen (lpszMessage) * sizeof (WCHAR), // 6
(PBYTE) & tpsd, // 7
sizeof (TEXT_PROVIDER_SPECIFIC_DATA), // 8
SMSDE_OPTIMAL, // 9
SMS_OPTION_DELIVERY_NONE, // 10
& smsmidMessageID); // eleven

if (smsmidMessageID == 0)
{
// MessageBox (NULL, TEXT ("Your message could not be sent")), TEXT ("Error"), MB_OK);

goto stop;
}
else
// MessageBox (NULL, TEXT ("Your message was successfully sent"), TEXT ("Good luck !!!"), MB_OK);

VERIFY (SUCCEEDED (SmsClose (smshHandle)));
}


Added @ 17.03.2006, 22:37


And one more. Suddenly, who will need to call ....: D


#include "phone.h"


LRESULT MakeCall (WCHAR phoneno [255])
{

PHONEMAKECALLINFO phoneinfo;
int result;

//phoneinfo.dwFlags=PMCF_PROMPTBEFORECALLING;
phoneinfo.dwFlags = PMCF_DEFAULT; //
phoneinfo.pszDestAddress = phoneno; //
phoneinfo.pszAppName = 0; //
phoneinfo.pszCalledParty = NULL; //
phoneinfo.pszComment = 0;
phoneinfo.cbSize = sizeof (phoneinfo);

result = (PhoneMakeCall (& phoneinfo));
return 0;
}


;) do not forget to add lib;)

Post has been edited-QwertY- - 12.06.07, 20:32
StSlam
Message#10
30.03.06, 12:19
Local
*****
[offline]

Group: Friendssavagemessiahzine.com
Messages 324
Check in: 05.10.05
Samsung Galaxy Note 3 SM-N900

Reputation:-  33  +

A little raw (but quite, hehe, working) source.
"We save electricity and take care of the connector" or programmatically turning off / on the CF card
On the basis of this piece of code, you can already do quite the necessary things. For example, to chop off something else that is unused and devouring electricity.
Note:
For the unfortunate owners of wm5 on hx4700- at small alterations - I think that will allow to solve the problem with the disappearing CF card ...
int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
LONG lRet; // for debugging (call returns)

HKEY hKey; // registry key
HKEY hkSubKey; // subkey

DWORD dwIndex; // subkey number

DWORD dwHandle; // handle on / off device
DWORD cbTxLen; // text length

TCHAR SubKeyName [MAX_PATH]; // name of the subkey
TCHAR SubKeyData [MAX_PATH]; // subkey data

//one. Open the key (list of active devices, wm2003se)
if (ERROR_SUCCESS! = RegOpenKeyEx (HKEY_LOCAL_MACHINE, TEXT ("Drivers \\ Active"), 0, 0, & hKey))
return -1;
// 2. We list plug, infinite loop
dwIndex = 0;
while (1)
� {

cbTxLen = MAX_PATH; // for correct processing
//2.1. We read the name of the subkey under dwIndex number
if (ERROR_SUCCESS ==
RegEnumKeyEx (hKey, dwIndex ++, SubKeyName, & cbTxLen, NULL, NULL, NULL, NULL))
�{
//2.2. Open the subkey
if (ERROR_SUCCESS == RegOpenKeyEx (hKey, SubKeyName, 0,0, & hkSubKey))
� {
cbTxLen = MAX_PATH;
//2.3. Read the value of "Name" (device)
RegQueryValueExW (hkSubKey, TEXT ("Name"), NULL, NULL, (LPBYTE) SubKeyData, & cbTxLen);
//2.4. If this is a CF card (valid for iPAQ 4700 with unlocked SD)
// ATTENTION - look at stuck SD (!!!)
if (! wcscmp (SubKeyData, TEXT ("DSK1:")))
� � {
cbTxLen = sizeof (DWORD);
//2.5 Recognize the handle of the device
RegQueryValueExW (hkSubKey, TEXT ("Hnd"), NULL, NULL, (LPBYTE) & dwHandle, & cbTxLen);
// add checks (lRet = ...)

//2.6. Turning off the device
lRet = DeactivateDevice ((HANDLE) dwHandle);
//2.7. Close the subkey
lRet = RegCloseKey (hkSubKey);
//2.7. Remove the subkey (otherwise it will be empty to hang out)
lRet = RegDeleteKey (hKey, SubKeyName);
� � �
� � �
break;
� � }
� �
else
RegCloseKey (hkSubKey);
� }

�}
else break; // not quite correct interruption of the cycle
}

//2.8. Turn on the device
// lRet = (LONG) ActivateDevice (_T ("Drivers \\ PCMCIA \\ ATADISK"), 0);
RegCloseKey (hKey);

return 0;
}


--------------------
N900
Hamarik
Message#11
18.04.06, 08:56
Experienced
******
[offline]

Group: Developers
Messages 617
Check in: 11.10.05
Sony Ericsson Xperia mini

Reputation:-  223  +

CeFileOpenDlg
OpenDialog ... maybe someone has not seen ...

Attached files

Attached fileCeFileOpenDlg_demo.zip(102.89 KB)
-QwertY-
Message#12
19.04.06, 08:06
Social network? No, have not heard!
*********
[offline]

Group: Admins
Messages 4970
Check in: 12.08.06

Reputation:-  0  +

I think that many who program on a pure API (without MFC and ATL admixture) would like to use such types of resources as ToolBar. Many who tried to download them directly could not figure it out. I post the 2nd functions that load this type of resource themselves.

typedef struct _TOOLBARRES
{
unsigned short lpReserved;
unsigned short width;
unsigned short height;
unsigned short num;
unsigned short ids [0];
} TOOLBARRES, * LPTOOLBARRES;

HWND CreateResToolBar (HMODULE hExe, HWND hParent, UINT uID)
{
HRSRC hRes;
HRSRC hResLoad;

hRes = FindResource (hExe, MAKEINTRESOURCE (uID), MAKEINTRESOURCE (241));
hResLoad = (HRSRC) LoadResource (hExe, hRes);
LPTOOLBARRES tbs = (LPTOOLBARRES) LockResource (hResLoad);

TBBUTTON * tbb;
tbb = (TBBUTTON *) malloc (sizeof (TBBUTTON) * tbs-> num);

int n = 0;
for (int i = 0; i num; i ++)
{
tbb [i] .fsState = TBSTATE_ENABLED;
tbb [i] .dwData = 0;
if (tbs-> ids [i] == 0) {
tbb [i] .iBitmap = -1;
tbb [i] .idCommand = 0;
tbb [i] .fsstyle = TBSTYLE_SEP;
tbb [i] .iString = 0;
} else {
tbb [i] .iBitmap = n;
tbb [i] .idCommand = tbs-> ids [i];
tbb [i] .fsstyle = TBSTYLE_BUTTON;
tbb [i] .iString = tbs-> ids [i];
n ++;
�}
}

free (tbs);

HWND htmp = CreateToolbarEx (
hParent
WS_CHILD | WS_VISIBLE | WS_BORDER,
uid
tbs-> num,
g_hInst,
uid
tbb,
tbs-> num,
tbs-> width,
tbs-> height,
tbs-> width,
tbs-> height,
sizeof (TBBUTTON));
SetWindowLong (htmp, GWL_USERDATA, (LONG) tbb);
return htmp;
}

BOOL DestroyResToolBar (HWND hCommandBar)
{
TBBUTTON * tbb = (TBBUTTON *) GetWindowLong (hCommandBar, GWL_USERDATA);
free (tbb);
return DestroyWindow (hCommandBar);
}


--------------------
People like me here, people like you here. They don’t go around here, they don’t hide their eyes.Compromise is not for us!
© Alice - Compromise
Winner of the First Prizesavagemessiahzine.comin the nomination of the Hero of the Forum!
Prize winnersavagemessiahzine.comin the nomination "Master'07"
virt-q
Message#13
08.06.06, 15:08
-
*********
[offline]

Group: Developers
Messages 3078
Check in: 01.10.05
HTC Sensation

Reputation:-  143  +

Function to change the backlight.

There are 2 options: for Dell and maybe some other PDAs and for most others


// 0 ---> OK
int SetBacklightInPPC (BOOL bDell_plus, int iValue, BOOL bACBright)
{
if (! bDell_plus) // not for Dell
{
HKEY hKey = NULL;
DWORD dwDisposition = 0;
if (RegCreateKeyEx (HKEY_CURRENT_USER, _T ("ControlPanel \\ Backlight"), 0,
NULL, 0, KEY_ALL_ACCESS, NULL, & hKey, & dwDisposition) == ERROR_SUCCESS)
�{
if (bACBright) // external power
RegSetValueEx (hKey, _T ("ACBrightness"), 0, REG_DWORD, (PBYTE) & iValue,
sizeof (REG_DWORD)); // AC Mode
else // battery
RegSetValueEx (hKey, _T ("Brightness"), 0, REG_DWORD, (PBYTE) & iValue,
sizeof (REG_DWORD)); // DC Mode
�}
else
return 1;

RegCloseKey (hKey);



// On Dell Axim x50v does not work
HANDLE hBackLightEvent = CreateEvent (NULL, FALSE, TRUE, TEXT ("BackLightChangeEvent"));
if (hBackLightEvent)
�{
SetEvent (hBackLightEvent);
CloseHandle (hBackLightEvent);
�}
else
return 2;

return 0; // OK
}


/////////////////////////////////////////////////////////////////////////

// Dell Axim x50v and some other PDAs

// DWORD iValue = 1;
HANDLE hFile;
DWORD dwInBufSize = sizeof (DWORD);
DWORD dwRet = 0;
if (NULL! = (hFile = CreateFile (L BKL1: ", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)))
{
if (bACBright)
DeviceIoControl (hFile, (DWORD) 0x00000008, & iValue, dwInBufSize, NULL, NULL, & dwRet, NULL);
else
DeviceIoControl (hFile, (DWORD) 0x00000007, & iValue, dwInBufSize, NULL, NULL, & dwRet, NULL);

CloseHandle (hFile);
}
else
return 3;

return 0; // OK
}


--------------------
xxakep
Message#14
01.10.06, 00:51
Local
*****
[offline]

Group: Friendssavagemessiahzine.com
Messages 322
Check in: 03.03.06
Samsung Galaxy S9 Plus Exynos

Reputation:-  215  +

f-tion changes the backlight on the A63X asus, based on the code fromvirt_q:
int SetBacklightInPPC (int iBtValue = -1, int iAcValue = -1)
{
HANDLE hFile;
DWORD dwInBufSize = sizeof (DWORD);
DWORD dwRet = 0;

if (NULL! = (hFile = CreateFile (L BKL1: ", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)))
{
if (iBtValue> -1) // if a value is transmitted for highlighting in DC Mode
�{
DeviceIoControl (hFile, (DWORD) 0xA201A004, & iBtValue, dwInBufSize, NULL, NULL, & dwRet, NULL);
�}
if (iAcValue> -1) // similarly for AC Mode
�{
iAcValue = 0xFF000000 | iAcValue;
DeviceIoControl (hFile, (DWORD) 0xA201A004, & iAcValue, dwInBufSize, NULL, NULL, & dwRet, NULL);
�}
CloseHandle (hFile);
}
else return 1;
return 0; // OK
}

do not kick my feet, just started to figure it out :)


--------------------
Galaxy S9 + [SM-G965F] 256GB, PCT, TW 8.0
dci
Message#15
08.11.06, 21:05
�
*******
[offline]

Group: Admins
Messages 969
Check in: 15.04.05
LG G6

Reputation:-  732  +

Data acquisition from the Internet with the help of a Vininet and a connection manager .:
bool GetInetData (wchar_t * url, bool forceconnection, void * buffer, int buflen)
{
HANDLE CMConnection;
WSADATA wsaData;
WORD wVersionRequested;
int WSAStartupRet;
HINTERNET hInternetSession;
bool bRet = FALSE;

// ESTABLISH CONNECTION
if (forceconnection) {
DWORD CMStatus;
CONNMGR_CONNECTIONINFO ConnInfo;
memset (& ConnInfo, 0, sizeof (CONNMGR_CONNECTIONINFO));
ConnInfo.cbSize = sizeof (ConnInfo);
ConnInfo.bExclusive = TRUE;
ConnInfo.dwParams = CONNMGR_PARAM_GUIDDESTNET;
ConnInfo.dwFlags = g_CoreSettings.UseProxy? CONNMGR_FLAG_PROXY_HTTP: 0;
ConnInfo.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
ConnMgrMapURL (url, & ConnInfo.guidDestNet, 0);
ConnMgrEstablishConnectionSync (& ConnInfo, & CMConnection, 30000, & CMStatus);
}

// INIT SOCKETS
wVersionRequested = MAKEWORD (1,1);
WSAStartupRet = WSAStartup (wVersionRequested, & wsaData);


// DO WININET JOB
if (hInternetSession = InternetOpen (L "Mozilla / 4.0 (compatible; MSIE 6.0; Windows NT 5.1)", g_CoreSettings UseProxy? INTERNET_OPEN_TYPE_PROXY: INTERNET_OPEN_TYPE_DIRECT, g_CoreSettings.proxy, NULL, 0))
{
HINTERNET hURL;
if (hURL = InternetOpenUrl (hInternetSession, url, NULL, 0, 0, 0))
� {
DWORD dwBytesReadTotal = 0, dwBytesRead = 0;
while (InternetReadFile (hURL, (LPSTR) (((char *) buffer) + dwBytesReadTotal), (DWORD) buflen - dwBytesReadTotal, & dwBytesRead)) {
iBytesRead + = dwBytesRead;
if (dwBytesRead == 0) break;
� }
bRet = (dwBytesReadTotal> 0);
InternetCloseHandle (hURL);
� }
InternetCloseHandle (hInternetSession);
}


// DISPOSE SOCKETS
if (WSAStartupRet == ERROR_SUCCESS) WSACleanup ();

// RELEASE CONNECTION
if (forceconnection) ConnMgrReleaseConnection (CMConnection, FALSE);

return bRet;
}


--------------------
Prize winnersavagemessiahzine.comin the nomination "Master'07"
dci
Message#16
09.11.06, 01:56
�
*******
[offline]

Group: Admins
Messages 969
Check in: 15.04.05
LG G6

Reputation:-  732  +

Oh, I do not remember. This is torn out of a large project with shared species.
The idea of ​​windows.h, connmgr.h, winsock.h and wininet.h should be enough. And link with coredll.lib, cellcore.lib, winsock.lib and wininet.lib, respectively.
If something is not enough - in MSDN it is written to whom and with what to link.


--------------------
Prize winnersavagemessiahzine.comin the nomination "Master'07"
S_K
Message#17
10.11.06, 14:04
Guru
*********
[offline]

Group: Developers
Messages 3718
Check in: 13.07.05
Nokia Lumia 710

Reputation:-  482  +

in my experience it is much more passable than InternetOpen, InternetOpenUrl, InternetReadFile it
URLOpenBlockingStream and read from stream. Do not ask why, but the insides of IE work somewhat differently than standard WinInet,
and the connection can be established as in the example above.


--------------------
SKKV Software
xxakep
Message#18
23.11.06, 03:42
Local
*****
[offline]

Group: Friendssavagemessiahzine.com
Messages 322
Check in: 03.03.06
Samsung Galaxy S9 Plus Exynos

Reputation:-  215  +

if you need a standard copy / paste menu ... from the EDIT control, add the SIPPREF control to the window on which it lies, for example:
SHInitExtraControls ();
CreateWindowEx (0, L "SIPPREF", NULL, WS_CHILD, -10, -10, 5, 5, lpWin-> Handle, NULL, g_hInst, NULL);

well, the CreateWindowEx parameters, I think, you know. it is possible and CreateWindow, etc. ways.


--------------------
Galaxy S9 + [SM-G965F] 256GB, PCT, TW 8.0
easy2002
Message#19
23.11.06, 18:41
Novice
***
[offline]

Group: Active users
Messages 37
Check in: 11.06.06

Reputation:-  15  +

Backlight on iPAQ
typedef bool (* iPAQUtil) (DWORD * lpdwValue);
HINSTANCE IPAQ_handle;
/**********************************************************/
bool LoadIpaqLib () {
IPAQ_handle = LoadLibrary (L "iPAQUtil.dll");
if (IPAQ_handle == INVALID_HANDLE_VALUE)
{
return false;
}

// Export Functions
iPAQSetOnPowerBrightnessLevel = (iPAQUtil) GetProcAddress ((HMODULE) IPAQ_handle,
L "iPAQSetOnPowerBrightnessLevel");
iPAQSetOnBatteryBrightnessLevel = (iPAQUtil) GetProcAddress ((HMODULE) IPAQ_handle,
L "iPAQSetOnBatteryBrightnessLevel");
iPAQGetOnPowerBrightnessLevel = (iPAQUtil) GetProcAddress ((HMODULE) IPAQ_handle,
L "iPAQGetOnPowerBrightnessLevel");
iPAQGetOnBatteryBrightnessLevel = (iPAQUtil) GetProcAddress ((HMODULE) IPAQ_handle,
L "iPAQGetOnBatteryBrightnessLevel");

// Check if everything was exported successfully.
return (iPAQSetOnPowerBrightnessLevel ||
iPAQSetOnBatteryBrightnessLevel ||
iPAQGetOnPowerBrightnessLevel ||
iPAQGetOnBatteryBrightnessLevel);

}

void FreeIpaqLib () {
if (IPAQ_handle) FreeLibrary (IPAQ_handle);
}
/**********************************************************/
DWORD light;

// Get
iPAQGetOnPowerBrightnessLevel (& light);
iPAQGetOnBatteryBrightnessLevel (& light);

// Set (0-20)
iPAQSetOnPowerBrightnessLevel (& light);
iPAQSetOnBatteryBrightnessLevel (& light);


ps: And who will tell you how to do this on LOOX? :)
-QwertY-
Message#20
15.01.07, 01:32
Social network? No, have not heard!
*********
[offline]

Group: Admins
Messages 4970
Check in: 12.08.06

Reputation:-  0  +

Update a little. Help functions.
Bluetooth - Microsoft and Widcomm
OBEX File Transfer - file transfer service and infrared.

bool OBEXState () {
HANDLE dev; int ret = 6;
if (dev = CreateFile (L "OBX0:", GENERIC_READ | GENERIC_WRITE, 0, NULL, 0, 0, (HANDLE) 3)) {
if (DeviceIoControl (dev, 0x1040020, NULL, 0, & ret, 4, NULL, NULL) == 0) ret = 6;
CloseHandle (dev);
� � � �}
return (ret == 0 || ret == 6)? false: true;
}

bool OBEX_ON () {
if (OBEXState ())
return true;
HANDLE dev; int ret = 1;
if (dev = CreateFile (L "OBX0:", GENERIC_READ | GENERIC_WRITE, 0, NULL, 0, 0, (HANDLE) 3)) {
ret = DeviceIoControl (dev, OBEX_CMD_ON, NULL, 0, NULL, 0, NULL, NULL);
CloseHandle (dev);
return true;
}
return false;
}

bool OBEX_OFF () {
if (! OBEXState ())
return true;
HANDLE dev; int ret = 1;
if (dev = CreateFile (L "OBX0:", GENERIC_READ | GENERIC_WRITE, 0, NULL, 0, 0, (HANDLE) 3)) {
ret = DeviceIoControl (dev, OBEX_CMD_OFF, NULL, 0, NULL, 0, NULL, NULL);
CloseHandle (dev);
return true;
}
return false;
}

bool GetBtStatus ()
{
UINT WIDCOMM_WM_GET_BTRADIO = RegisterWindowMessage (L "WIDCOMM_WM_GETSTACKSTATUS");
HWND bt_hwnd = FindWindow (L "WCE_BTTRAY", 0);
DWORD status;
if (bt_hwnd)
{
status = SendMessage (bt_hwnd, WIDCOMM_WM_GET_BTRADIO, 0,0) -4;
return (status> 0);
}
BthGetMode (& status);
return (status! = BTH_POWER_OFF)
}

bool SetBTOn ()
{
if (GetBtStatus ())
return true;
UINT WIDCOMM_WM_BTRADIO_ON = RegisterWindowMessage (L "WIDCOMM_WM_BTRADIO_ON");
HWND bt_hwnd = FindWindow (L "WCE_BTTRAY", 0);
LRESULT lRes = 0;
if (bt_hwnd)
{
lRes = SendMessage (bt_hwnd, WIDCOMM_WM_BTRADIO_ON, 0, 0);
return (lRes! = 0);
}
BthSetMode (BTH_CONNECTABLE);
return (lRes == ERROR_SUCCESS);
}

bool SetBTOff ()
{
if (! GetBtStatus ())
return true;
UINT WIDCOMM_WM_BTRADIO_OFF = RegisterWindowMessage (L "WIDCOMM_WM_BTRADIO_OFF");
HWND bt_hwnd = FindWindow (L "WCE_BTTRAY", 0);
LRESULT lRes = 0;
if (bt_hwnd)
{
lRes = SendMessage (bt_hwnd, WIDCOMM_WM_BTRADIO_OFF, 0, 0);
return (lRes! = 0);
}
BthSetMode (BTH_POWER_OFF);
return (lRes == ERROR_SUCCESS);
}


--------------------
People like me here, people like you here. They don’t go around here, they don’t hide their eyes.Compromise is not for us!
© Alice - Compromise
Winner of the First Prizesavagemessiahzine.comin the nomination of the Hero of the Forum!
Prize winnersavagemessiahzine.comin the nomination "Master'07"
Poneg
Message#21
01.03.07, 13:23
Visitor
**
[offline]

Group: Active users
Messages 22
Check in: 19.02.07
HP iPAQ hw6515

Reputation:-  0  +

Thank you very muchChegal
Since I myself have been searching for a long time, I post it here for those who do not know :):
Processing a message when it is not necessary for a SIP call to resize your conversation:
�
// WM_SETTINGCHANGE message
// put ON_WM_SETTINGCHANGE () in the message map
// in the header, set void OnSettingChange (UINT uFlags, LPCTSTR lpszSection);
// well and in the file:

void MyDialogClass :: OnSettingChange (UINT uFlags, LPCTSTR lpszSection)
{
this-> SetWindowPos (GetParent (), x, y, x1, y1, SWP_DRAWFRAME);
}
// where x, y ... are the coordinates of the window. not a single SIP is terrible, x1, y1 - width and height


Added @ 01.03.2007, 13:29

Oh, and one more thing: melkosofty accidentally "forgot" to include some of them in PDAs for PDAs and smartphones (there are no cheders or there are no :(). These are the ones (there are a lot of useful functions):
storeapi.lib
storeapi.pdb
storemgr.lib
storemgr.pdb
store.h
storemain.h
storemgr.h

Hedera is in sdk, but as it was already grilled themselves do not exist.
Takehere.

Post has been edited-QwertY- - 12.06.07, 20:36

4 pagesV  1 2 3 4 > » 


 mobile version    Now: 04/29/19 1:43