try with
#include
#pragma comment(lib,"Wininet.lib")
try with
#include
#pragma comment(lib,"Wininet.lib")
CTime::GetCurrentTime() returns a CTime object, not a string, so it has not a format. To get the formatted string, have you used the CTime::Format function? Use it with %I instead of %H. P.S.: you cannot read the documentation on MSDN?
If I understood, you can try with a union: union FIELDEX { struct FIELD { uint8_t b0:1; uint8_t b1:1; uint8_t b2:1; uint8_t b3:1; uint8_t b4:1; uint8_t b5:1; uint8_t b6:1; uint8_t b7:1; } fld; uint8_t val; }; FIELDEX test; test.val = 0x7A; // 0111 1010 test.fld.b0 = 1; // set bit 0
To get the text portion currently selected? See CEdit::GetSel.
Please, don't give such a bad solution!!! I've adjusted it to avoid global variables:
#include #include bool solver(float a,float b, float c, float &x1, float &x2)
{
float delta = sqrt( (b*b) - (4*a*c) );
if (!a) return false;
x1 = ( -b + delta)/(2\*a);
x2 = ( -b - delta)/(2\*a);
return true;
}
int main()
{
float a=2,
b=4,
c=-30;
/*
printf("a = ");
scanf("%f", &a);
printf("b = ");
scanf("%f", &b);
printf("c = ");
scanf("%f", &c);
*/
float x1,x2;
if ( solver(a, b ,c, x1, x2) ) printf("x1=%f\nx2=%f\n",x1,x2);
return 0;
}
You have lot of controls? Why don't you use a function? Example:
void CFacePlate::SetDlgItemVisible(int idCtrl, int iTagType)
{
if (oTagBase->GetTagType() == iTagType)
{
GetDlgItem(idCtrl)->ShowWindow(SW_SHOW);
}
else
{
GetDlgItem(idCtrl)->ShowWindow(SW_HIDE);
}
}
BOOL CFacePlate::OnInitDialog()
{
CDialog::OnInitDialog();
SetDlgItemVisible(IDC_STATECOMBO, INDICATOR);
SetDlgItemVisible(IDC_SPVALUE, CONTROLLER);
}
I think you cannot suspend the shutdown process, but you can cancel it returning FALSE to the WM_QUERYENDSESSION message. Maybe, while you are in your WM_QUERYENDSESSION message handler, the shutdown process is suspended, except when ExitWindowsEx was called with the flag EWX_FORCEIFHUNG, but I'm not sure about that.
The handle of what window? To retrieve all windows of a process, you have to call EnumWindows and, for each window, use GetWindowThreadProcessId to check if a window belongs to a process (the ProcessID of the window equals the ProcessID of the process).
CheckSumPair* CSPair = new CheckSumPair[10];
or better, if possible:
CheckSumPair CSPair[10];
And finally, you have to explain what are you trying to do with the two strncpy, maybe your code has to be like:
#define UINT32 unsigned int
#define INT32 int
#define UCHAR unsigned char
typedef struct
{
UINT32 weakcs; // The weak, rolling Adler32 checksum.
UCHAR StrongCS[10 + 1]; // including the string terminator
UCHAR StrongCSString[10 + 1]; // including the string terminator
} CheckSumPair;
int main()
{
CheckSumPair CSPair[10];
for(int x = 0; x < 10; x++)
{
CSPair\[x\].weakcs = (UINT32)x+1;
strncpy((char\*)CSPair\[x\].StrongCS, "XYZ", 10);
strncpy((char\*)CSPair\[x\].StrongCSString, "CEDVCD", 10);
}
for(int x = 0; x < 10; x++)
{
printf("%d %s %s\\n\\n", CSPair\[x\].weakcs, CSPair\[x\].StrongCS, CSPair\[x\].StrongCSString);
}
return 0;
}
Maybe you need to check HRESULT to see what is wrong. However, have you called CoInitialize or CoInitializeEx first? And finally, you can write: HRESULT hres = sobj.CreateInstance(OLESTR("ScriptObj.ScriptObj"));
LPTHREAD_START_ROUTINE is defined as: typedef DWORD (WINAPI *PTHREAD_START_ROUTINE)( LPVOID lpThreadParameter ); typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; so, your thread function is to be: static DWORD WINAPI Threadi(LPVOID lpThreadParameter) { System::Windows::Forms::MessageBox::Show("Hi there!"); return 0; }
GetCommandLine ?