|
VS isn't capable (to the best of my knowledge), but the header files are from the platform SDK, which is usable by other compilers. This way they keep a common source.
Iain.
|
|
|
|
|
Dear All,
we are managing a very big ascii files that we should like to save in a DB as zipped file.
When user should like to know the content of the file I don't want to extract and save a local copy of the file, unzip and show to the user the content. What I want to do is to read the file and unzip it in the memory on the fly without saving it.
Does any one can help me ?
Thanks
Nicola
|
|
|
|
|
|
Hi,
another question:
i want to shut down the pc...
i tried with "ExitWindowsEx(EWX_SHUTDOWN ,EWX_FORCE);"
EWX_POWEROFF
but don't work....
have you got an idea?
regards
giulio
|
|
|
|
|
Ing.Raiz82 wrote: "ExitWindowsEx(EWX_SHUTDOWN ,EWX_FORCE);"
the parameter are incorrect. Use a below
ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE, SHTDN_REASON_MAJOR_OTHER );
nave
|
|
|
|
|
thanks....
but don't work...
i don't understand....
i create a simple button and..
void CSmartAdvertiseDlg::OnBnClickedButton1()
{
ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE, SHTDN_REASON_MAJOR_OTHER );
}
but don't work.....ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
thanks
giulio
|
|
|
|
|
Whats return value of ExitWindowsEx
|
|
|
|
|
U can't directly use this API. To use the API, u'r process should have sufficient privileges. The Privilege required is SE_SHUTDOWN_NAME. Use
OpenProcessToken() and
AdjustTokenPrivileges() to get the right privilege.
Come online at:-
jubinc@skype
|
|
|
|
|
thanks a lot...
but i'm a beginner...
can you see me an example?
sorry... and thanks too...
|
|
|
|
|
See here[^] how to use this function
|
|
|
|
|
|
thank you so much..
bye...
Giulio
|
|
|
|
|
|
ok....
This is the code... it work....
//giulio shutdown pc
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if (OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
{
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if(AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0))
{
ExitWindowsEx(EWX_SHUTDOWN|EWX_POWEROFF|EWX_FORCE,0);
}
}
Bye
Giulio
|
|
|
|
|
ExitWindowsEx
Windows NT/2000/XP: To shut down or restart the system, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege. For more information about security privileges, see Privileges.
Windows 95/98/Me: ExitWindowEx does not work from a console application.
HANDLE hToken; // handle to process token
TOKEN_PRIVILEGES tkp; // pointer to token structure
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
{
return (FALSE);
}
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
// Get shutdown privilege for this process.
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES) NULL, 0);
Then call ExitWindowsEx function
Known is a drop, unknown is an ocean
|
|
|
|
|
I have a partly developed MFC project. When we execute that project a window will open. In that window, a tool bar, a status bar are already created. In the status bar an idle text "Ready" is displayed in the right corner. In the left corner a pane is already there.
I also created one pane to the left of already existing pane.I do not know how they created the already existing pane. I created the second pane by specifying the ID of the second pane in the string table. Now I want to access the Properties window for the status bar(I have to). How can I do this?
|
|
|
|
|
This may not be the most helpful answer, but there *isn't* a properties window for a status bar.
If you want one when the program is running, then you'll have to subclass the status bar, handle WM_CONTEXT, and bring up your own dialog box.
What I *think* you mean is how to work out where this stuff is getting added...
Look in CMainFrame for a member variable called m_StatusBar (or similar). When you know that name, do a search for it, and you'll find any reference to it. The bits you want are probably in CMainFrame::OnCreate. You might also want to check if they're using CStatusBar, or CMyCustomMadeUpStatusBar. If they used their own bar, you'll need to dig into their class and see what it does.
Iain.
|
|
|
|
|
T.RATHA KRISHNAN wrote: I created the second pane by specifying the ID of the second pane in the string table.
Simply adding an ID to the stringtable resource will not cause a new pane to be created. You must add an item to the indicators array in the frame's code.
T.RATHA KRISHNAN wrote: Now I want to access the Properties window for the status bar(I have to). How can I do this?
Do you have an example of this?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How can I drag and drop text that user enters in the window?
Should I check if the user clicked inside the rectangle that contains the text?
Sikora
|
|
|
|
|
If u want the drag & drop of the text in edit control and within that control, then use
Rich Edit Control . Drag & Drop is built-in functionality of it.
Come online at:-
jubinc@skype
|
|
|
|
|
We have a dynamic text and we need to obtain the coordinates of the rectangle that contains the text. How can I do that? I should use the function GetTextExtent.
Sikora
|
|
|
|
|
|
Are you wanting to drag text out of a control, or drop text into a control?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
Problem: i have a list (CToolTipListCtrl)
question: i want to move two or more element from a list... have you got a idea??
CODE:
void CSmartAdvertiseDlg::OnBnClickedDown()
{
if(m_cPlaylist.GetSelectedCount() == 1)
OnBnClicked(DOWN);
}
void CSmartAdvertiseDlg::OnBnClicked(int iOp)
{
POSITION Pos;
LVITEM lvi1,lvi2;
int iPos,iPeriod,iPos2,count,ret;
CString sPeriod,str1,str2;
listDataStruct *data;
lvi1.mask = LVIF_IMAGE | LVIF_TEXT;
lvi2.mask = LVIF_IMAGE | LVIF_TEXT;
if((Pos = m_cPlaylist.GetFirstSelectedItemPosition()) != NULL)
{
while(Pos)
{
iPos = m_cPlaylist.GetNextSelectedItem(Pos);
ret = sscanf(m_cPlaylist.GetItemText(iPos,2),"%d",&iPeriod);
switch (iOp)
{
case PLUS:
case MINUS:
if(ret == 1)
{
if(iOp == PLUS)
{
if(iPeriod<999)
iPeriod++;
}
else if (iPeriod)
iPeriod--;
sPeriod.Format("%d",iPeriod);
lvi1.iItem = iPos;
lvi1.iSubItem = 2;
lvi1.pszText = sPeriod.GetBuffer();
m_cPlaylist.SetItem(&lvi1);
UpdateData(FALSE);
}
else
{
//AfxMessageBox(IDS_NOT_IMAGE);
}
break;
case DOWN:
case UP:
if(iOp == UP)
iPos2=iPos-1;
else
iPos2=iPos+1;
count = m_cPlaylist.GetItemCount();
if(iPos2<0)
break;
//iPos2 = count-1;
if(iPos2==count)
break;
//iPos2=0;
for (int i = 0; i < m_wndHeader.GetItemCount(); i++)
{
lvi1.iItem = iPos;
lvi1.iSubItem = i;
lvi1.pszText = str1.GetBuffer(255);
lvi1.cchTextMax = 255;
lvi2.iItem = iPos2;
lvi2.iSubItem = i;
lvi2.pszText = str2.GetBuffer(255);
lvi2.cchTextMax = 255;
m_cPlaylist.GetItem(&lvi1);
m_cPlaylist.GetItem(&lvi2);
lvi2.iItem = iPos;
lvi1.iItem = iPos2;
m_cPlaylist.SetItem(&lvi1);
m_cPlaylist.SetItem(&lvi2);
}
data = (listDataStruct *)m_cPlaylist.GetItemData(iPos);
m_cPlaylist.SetItemData(iPos,m_cPlaylist.GetItemData(iPos2));
m_cPlaylist.SetItemData(iPos2,(DWORD_PTR)data);
m_cPlaylist.SetItemState(iPos, 0, LVIS_SELECTED);
m_cPlaylist.SetItemState(iPos2, LVIS_SELECTED, LVIS_SELECTED);
break;
}
}
m_cUpdate.EnableWindow(FALSE);
}
}
thanks, regards...
Giulio
ps. i hope that my english is comprehensible....sorry...ehhehe
|
|
|
|
|
Ing.Raiz82 wrote: question: i want to move two or more element from a list... have you got a idea??
Use the list control's DeleteItem() method.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|