|
Try to define your thread function as:
static unsigned WINAPI runSearch(void* pThreadParameter);
That's what I use with _beginthreadex(). Hope it helps!
|
|
|
|
|
Hello,
I'm working on shell extension but I've got a problem. I would like user able to select one or more files and also folders and right click to access my software (Firegraphic XP). However, when user select more then one folder and access the "Explorer, Open or Search...", my software launch instead of the Explorer. And my software looks launch for each folder. If user only select one folder, everything seems fine. Here's the code I wrote, hope someone can give me some idea.
HRESULT CFiregrxpShEx::QueryContextMenu(
HMENU hmenu,
UINT uMenuIndex,
UINT uidFirstCmd,
UINT uidLastCmd,
UINT uFlags)
{
if (uFlags & CMF_DEFAULTONLY)
return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0);
if (m_files.IsEmpty())
return E_INVALIDARG;
int nMenu = 0;
// m_files is the files & folders list (can be max), if the first selected
// is a folder then I want to launch Firegraphic XP and open that folder
if (PathIsDirectory(m_files[0]))
{
InsertMenu(hmenu, uMenuIndex, MF_BYPOSITION, uidFirstCmd++, _T("Browse with Firegraphic XP"));
SetMenuItemBitmaps(hmenu, uMenuIndex, MF_BYPOSITION, g_hBmpFiregrxp, NULL);
nMenu++;
}
else
{
// User selected images
}
return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, nMenu);
}
HRESULT CFiregrxpShEx::InvokeCommand(LPCMINVOKECOMMANDINFO pCmdInfo)
{
if (m_files.IsEmpty())
return E_INVALIDARG;
// Get the Firegraphic.exe InstallPath
TCHAR szPath[MAX_PATH];
HKEY hKey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Firegraphic\\Firegraphic XP"), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
DWORD nData = sizeof(szPath);
if (RegQueryValueEx(hKey, _T("InstallPath"), 0, NULL, (LPBYTE)szPath, &nData) == ERROR_SUCCESS)
PathAppend(szPath, _T("FiregraphicXP.exe"));
RegCloseKey(hKey);
}
STARTUPINFO sui = { 0 };
PROCESS_INFORMATION pi = { 0 };
TCHAR szQuotedFileName[MAX_PATH];
if (PathIsDirectory(m_files[0])) // Browse with Firegraphic XP
{
TCHAR szCmdLine[MAX_PATH];
lstrcpy(szQuotedFileName, m_files[0]);
PathQuoteSpaces(szQuotedFileName);
lstrcpy(szCmdLine, _T(" "));
lstrcat(szCmdLine, szQuotedFileName);
if (CreateProcess(szPath, szCmdLine, NULL, NULL, FALSE, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, &sui, &pi))
{
CloseHandle(pi.hProcess);
return S_OK;
}
}
return E_INVALIDARG;
}
Hiu Sing Ngai
Firegraphic.com
|
|
|
|
|
On XP the shell invokes context menu extensions when you pick something from the lists on the left Explorer pane. At the beginning of InvokeCommand(), you're not checking pCmdInfo->lpVerb, so your code is running regardless of what menu item was picked (even if it wasn't yours). Check that value, and if it isn't 0, return E_INVALIDARG without doing anything. (It will be 0 for your own menu because lpVerb is a 0-based index telling you which of your menu items was picked; in other cases it's a shell ID or a string.)
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Thanks Mike, you saved me lots of time.
|
|
|
|
|
Anyone happen to have the source ZIP file for this app? It's been removed from the MSDN site.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I have a ThemeExplorer sample from the Platform SDK on my HD. Is this the one you are after?
Michael
Logic, my dear Zoe, merely enables one to be wrong with authority. - The Doctor
|
|
|
|
|
|
I want to use somthing like varible that need to be same value for the process. But different values for different processes. How can i do that?
I meant it needs to be in DLL ? Here the variable is single only.
VIKS
|
|
|
|
|
Like GetCurrentProcessId?
Btw, within that process it's not a variable, it's a constant.
|
|
|
|
|
No sir,
But I want a variable only not the constants.
VIKS
|
|
|
|
|
I have a dialog resource in my project with on that dialog a static bitmap. Under Windows 98 it shows the bitmap just fine but under Windows 2000 it doesn't show anything...
Does anyone know why this could be?
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
Before three hours while iam doing the final integration in my VC++ 6 project, the resource file in my app is only 111MB, but now its 165 MB. Complier throws error like REsource file too large.
Need Advice or Help to be needed. Its Urgent. If you know mail me at shivaa_27@yahoo.com.
Thanks
Shivaa.
India.
|
|
|
|
|
Split it up in two files...
|
|
|
|
|
Hello redeemer,
Thanks. But the exe size also increasing. I dont know the hell it is. How to split the rc file in to two.
Shivaa..
|
|
|
|
|
Just put some of the resource in a second file and add that file your project.
|
|
|
|
|
Excuse me? You call a resource file of one hundred and eleven bloody megabyte "only 111MB"?!
Whatever you have been drinking, or whatever mushrooms you have been chewing, I want nothing to do with them. Where are you from? The "Planet Redmond Office"?
|
|
|
|
|
hi there..
im trying for a database application .. well every thing is going fine till i come up to the add record thing .. it works if i had some entries already present in my access database ..
but if the database is empty it gives me an error message
"operation failed no current recoord"
hope u guys could hlp me out
looking forward from all the gurus of code
|
|
|
|
|
are you doing any operations like movefirst befire adding the database item. check the empty status before entering
Samir Sood
|
|
|
|
|
Why are the simplest things always hidden so well?
|
|
|
|
|
It's not hidden. It doesn't exist. (at least officially)
Try out http://www.codeproject.com/tools/vsrename.asp
|
|
|
|
|
Copy the .dsp and .dsw to another place. Rename them. Open them in a text editor (such as MSVC itself - but open them as text!). Replace appropriate sections.
Some might say "Why in the name of ... is this so complicated". It's not, it's the way of Microsoft: Whenever you can make something undocumented: Make it so!
|
|
|
|
|
Hi
I try to launch the screensaver with password protection. I tried this code:
SendMessage(GetDesktopWindow(),WM_SYSCOMMAND,SC_SCREENSAVE,0);
but this starts the screensaver without password protection.
Therefore I wrote my own function to call a screensaver and protect the workstation:
#include "stdafx.h"
#include <stdio.h>
#include <shellapi.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
char WinDir[256], ScrDir[256], RunDir[256];
GetWindowsDirectory(WinDir,sizeof(WinDir));
sprintf(ScrDir,"%s\\System32\\sstext3d.scr",WinDir);
sprintf(RunDir,"%s\\System32\\rundll32.exe",WinDir);
SHELLEXECUTEINFO sei = { 0 };
sei.cbSize = sizeof( sei );
sei.lpVerb = "open";
sei.lpFile = ScrDir;
sei.nShow = SW_SHOWNORMAL;
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
if( ShellExecuteEx( &sei ) )
{
WaitForSingleObject( sei.hProcess, INFINITE );
ShellExecute(GetDesktopWindow(),"open",RunDir,"user32.dll,LockWorkStation","",SW_SHOWNORMAL);
}
return 0;
}
It first launches the screensaver via ShellExecuteEx and then waits until it's finished. (WaitForSingleObject). Right after that, the workstation is being locked using a Rundll code.
But how safe is this code? Will the user still be able to bypass the lock or is my code safe enough?
reagrds
Greg
modified 12-Sep-18 21:01pm.
|
|
|
|
|
*Puts paranoia level security hat on*
What guarantee do you have that between
<br />
WaitForSingleObject( sei.hProcess, INFINITE );<br />
and
<br />
ShellExecute(GetDesktopWindow(),"open",RunDir,"user32.dll,LockWorkStation","",SW_SHOWNORMAL);<br />
Nothing else gets a chance to run?
|
|
|
|
|
But how safe is this code?
Not especially safe.
Right after that, the workstation is being locked using a Rundll code.
And that "code" would be... 42? 4711?
Will the user still be able to bypass the lock or is my code safe enough?
In order: "Yes" and "No way".
Isn't there a semi-documented RunDll32.dll entry point to start the screensaver?
|
|
|
|
|
i have a list box and a text field....
if the user select an element in the list box, the CString of the selected element should go to the text field...
i think it can be made by the " SendDlgItemMessage(IDC_SAVENAME,...."
but i don't know the uint message for doing this.
can someone help???
i use vs 6.0....
thanx a lot and have a nice weekend!
tom.
|
|
|
|
|