Click here to Skip to main content
16,014,650 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CImageList + BitBlt Pin
Shog94-Apr-02 9:15
sitebuilderShog94-Apr-02 9:15 
GeneralRe: CImageList + BitBlt Pin
4-Apr-02 9:39
suss4-Apr-02 9:39 
GeneralCPrintDialog Pin
Rick Crone4-Apr-02 8:14
Rick Crone4-Apr-02 8:14 
GeneralRe: CPrintDialog Pin
Shog94-Apr-02 9:42
sitebuilderShog94-Apr-02 9:42 
GeneralRe: CPrintDialog Pin
Rick Crone4-Apr-02 11:28
Rick Crone4-Apr-02 11:28 
GeneralRe: CPrintDialog Pin
Shog94-Apr-02 12:26
sitebuilderShog94-Apr-02 12:26 
GeneralRe: CPrintDialog Pin
Rick Crone9-Apr-02 4:13
Rick Crone9-Apr-02 4:13 
GeneralRe: CPrintDialog Pin
Shog99-Apr-02 5:18
sitebuilderShog99-Apr-02 5:18 
Almost. They are offsets from the beginning of the structure. This lets you copy the whole thing around without worry, but also makes it somewhat more difficult to initialize:
// device names; these would normally be obtained
// via EnumPrinters()
const char* szDriverName = "winspool";
const char* szPrinterName = "\\\\MCL002NT\\CLIREQ";
const char* szPortName = "PRI15:CLIREQ_P1";

int nDriverEnd  = sizeof(DEVNAMES) + strlen(szDriverName)+1;
int nPrinterEnd = nDriverEnd + strlen(szPrinterName)+1;
int nPortEnd    = nPrinterEnd + strlen(szPortName)+1;

HANDLE hDevNames = ::GlobalAlloc(GHND, nPortEnd);
DEVNAMES* pDevNames = (DEVNAMES*)::GlobalLock(hDevNames);
pDevNames->wDefault = 0;
pDevNames->wDriverOffset = sizeof(DEVNAMES);
pDevNames->wDeviceOffset = nDriverEnd;
pDevNames->wOutputOffset = nPrinterEnd;
strcpy((char*)(pDevNames)+sizeof(DEVNAMES), szDriverName);
strcpy((char*)(pDevNames)+nDriverEnd, szPrinterName);
strcpy((char*)(pDevNames)+nPrinterEnd, szPortName);
::GlobalUnlock(hDevNames);

Note: this is *not* Unicode aware; you'll need to double all the offsets and sizes (except the size of the DEVNAMES structure itself) if you're doing a Unicode build.

Also Note: the print dialog functions work with memory handles. It might be possible to substitute pointers, but i've never seen it done this way, and so i doubt it.

Good Luck! Smile | :)

Developers that like shiny objects also dig case mods and scratch-and-sniff stickers.

Klaus Probst, The Lounge


GeneralRe: CPrintDialog Pin
Rick Crone9-Apr-02 6:21
Rick Crone9-Apr-02 6:21 
GeneralRe: CPrintDialog Pin
Shog99-Apr-02 7:27
sitebuilderShog99-Apr-02 7:27 
GeneralRe: CPrintDialog Pin
Rick Crone9-Apr-02 7:43
Rick Crone9-Apr-02 7:43 
Generalpointer to a function Pin
moredip4-Apr-02 8:07
moredip4-Apr-02 8:07 
GeneralRe: pointer to a function Pin
Tim Smith4-Apr-02 8:08
Tim Smith4-Apr-02 8:08 
GeneralRe: pointer to a function Pin
moredip4-Apr-02 8:24
moredip4-Apr-02 8:24 
GeneralRe: pointer to a member function Pin
Paul M Watt4-Apr-02 8:22
mentorPaul M Watt4-Apr-02 8:22 
GeneralRe: pointer to a function Pin
moredip4-Apr-02 8:31
moredip4-Apr-02 8:31 
GeneralXor function Pin
Mazdak4-Apr-02 5:56
Mazdak4-Apr-02 5:56 
GeneralRe: Xor function Pin
Tomasz Sowinski4-Apr-02 6:01
Tomasz Sowinski4-Apr-02 6:01 
GeneralRe: Xor function Pin
Mazdak4-Apr-02 6:37
Mazdak4-Apr-02 6:37 
GeneralCListCtrl GetSelectionMark() probs Pin
dazinith4-Apr-02 4:47
dazinith4-Apr-02 4:47 
GeneralRe: CListCtrl GetSelectionMark() probs Pin
dlhson4-Apr-02 4:54
dlhson4-Apr-02 4:54 
GeneralRe: CListCtrl GetSelectionMark() probs Pin
dazinith4-Apr-02 5:03
dazinith4-Apr-02 5:03 
GeneralRe: CListCtrl GetSelectionMark() probs Pin
dazinith4-Apr-02 5:28
dazinith4-Apr-02 5:28 
GeneralRe: CListCtrl GetSelectionMark() probs Pin
Ravi Bhavnani4-Apr-02 6:05
professionalRavi Bhavnani4-Apr-02 6:05 
GeneralRe: CListCtrl GetSelectionMark() probs Pin
dazinith4-Apr-02 6:25
dazinith4-Apr-02 6:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.