You could use a session cookie then retrieve the value from $_COOKIE as they move thru the site.
DLChambers
Posts
-
Track traffic sources using PHP get? -
Customization of defaul buttons provided in PropertyPagesIn order to show all 3 of
Back
,Next
, andFinish
, you gotta move the buttons. Here's the Microsoft Knowledgebase page with sample code: http://support.microsoft.com/kb/q143210/[^] -
HWND that *sent* a MSG?It's a registered message, sent between associated apps. I want the receiving app to be able to display (in a list) the name of the app that sent the msg. I could pass the sender's HWND in the wParam or lParam, but I'm extending an existing app that already uses W and L, so I'm plumb out of args and trying to cook up a workaround :)
-
Check if is folder or file function?Here's a Win95 :) compatible way of doing it:
// Get full attributes
DWORD dwAttrib = GetFileAttributes(psPath);
// Convert non-existance code to a value that will fail the bit-test
if(0xFFFFFFFF == dwAttrib)
dwAttrib = 0;
// Does it exist, and is it a dir?
if(0 != (dwAttrib&FILE_ATTRIBUTE_DIRECTORY))
// It's a dir! -
Making a file not accessible by other applicationsHANDLE hFile = CreateFile( psFile, GENERIC\_READ | GENERIC\_WRITE, 0, // No sharing NULL, OPEN\_EXISTING, FILE\_ATTRIBUTE\_NORMAL, NULL); DWORD dwErr = GetLastError(); // NOTE: Error 5 likely indicates file is marked read-only
...
CloseHandle(hFile); // Unlock it
-
About Invoke HelperWhat's your context? The docs say that InvokeHelper is part of the
COleDispatchDriver
andCWnd
classes, thus when you callInvokeHelper()
you're really calling::InvokeHelper()
, which doesn't exist in the global namespace. -
A problem with loopsActually, it should be written thus:
if (-1 == Channel)
so if you mistakenly use
=
instead of==
the compiler will puke. If you get in the habit of putting the constant on the left side of the equation it'll save you many headaches. -
Abstract Class, Socket Programming, JPEG in VC6You can use OleLoadPicture(). The following code two-steps it - loads the JPG into a HBITMAP then draws the HBITMAP If you just wanted load & draw it w/o the intermediate BMP you could call pPic->Render() into the dialog's DC.
#include <Ole2.h>
#include <olectl.h>
#define HIMETRIC_INCH 2540
HBITMAP LoadJpgFile(LPCTSTR filename)
{
HBITMAP hBmp = NULL;if(filename && *filename)
{
HANDLE hFile = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
if(hFile)
{
DWORD dwFileSize = GetFileSize(hFile, NULL);
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, dwFileSize);
if(hGlobal)
{
LPVOID pvData = GlobalLock(hGlobal);
if(pvData)
{
DWORD dwBytesRead = 0;
BOOL bRead = ReadFile(hFile, pvData, dwFileSize, &dwBytesRead, NULL);
GlobalUnlock(hGlobal);if(bRead && (dwBytesRead==dwFileSize)) { LPSTREAM pstm = NULL; HRESULT hr = ::CreateStreamOnHGlobal(hGlobal, TRUE, &pstm); if(pstm) { LPPICTURE pPic = NULL; hr = ::OleLoadPicture(pstm, dwFileSize, FALSE, IID\_IPicture, (LPVOID\*)&pPic); if(pPic) { // Retrieve logical dimensions long lWidth=0, lHeight=0; pPic->get\_Width(&lWidth); pPic->get\_Height(&lHeight); HDC hMemDC = CreateCompatibleDC(NULL); if(hMemDC) { // Map logical dimensions to physical device int nWidth = MulDiv(lWidth, GetDeviceCaps(hMemDC, LOGPIXELSX), HIMETRIC\_INCH); int nHeight = MulDiv(lHeight, GetDeviceCaps(hMemDC, LOGPIXELSY), HIMETRIC\_INCH); if((nWidth>=0) && (nHeight>=0)) { HDC dcScreen = GetDC(NULL); if(dcScreen) { HBITMAP hJpgBmp = ::CreateCompatibleBitmap(dcScreen, nWidth, nHeight); if(hJpgBmp) { HBITMAP hPrevBmp = (HBITMAP)::SelectObject(hMemDC, hJpgBmp); RECT rect = {0,0, nWidth,nHeight}; hr = pPic->Render(hMemDC, 0, 0, nWidth, nHeight, 0, lHeight, lWidth, -lHeight, &rect); ::SelectObject(hMemDC, hPrevBmp); if(SUCCEEDED(hr)) hBmp
-
Problem Putting Dialog on topHave you tried modeless dialogs?
-
Problem about ListBox itemIn the standard listbox rendering, Focus typically draws a dashed rect around the "current" item and Selected shows the item in color. The difference is useful if you want to e.g. keep the Selected item highlighted when the listbox is not focused. Usually only the affected items are redrawn. For example, if you have item 1 selected and click on item 2, you'd get draw messages for item 1 (with the selected flag cleared) and item 2 (with the selected flag set), but no draw msgs for items 0 or 3. If oyu *scroll* the listbox you'll get draw messages for all visible (either partially or fully) items, but not for those items whose rects fall outside (above/below) the window's client area.
-
Storing files in a dll, or somewhere like that...You could indeed store all those the files in a dll and extract them either as-needed or extract them all upon app startup to a temp dir then delete the temp dir on app exit. The typical way to store data (eg: a file) in a dll is to put it in the dll's resource table.
-
HWND that *sent* a MSG?When my app rx'es a message, it gets it in the form of a MSG struct. That MSG contains the HWND that is to receive the message (i.e. my wnd). Is there any way to find the main HWND of the process that sent the message?