Managing DEVMODE and DEVNAMES Before/After PrintDlgEx

Hello,
I have a COM application that is using the PrintDlgEx method to manage custom printing and a tool that lets users preview printed pages on a map.  Our app gets the DEVMODE and DEVNAMES structures from the default printer at initialization time. 
So, all our usage of PrintDlgEx starts with us having a DEVMODE/DEVNAMES structure already. 
I have several questions about managing the DEVMODE and DEVNAMES structures properly.  My problem is that I have been unable to find examples that show examples that start with these structures before calls to PrintDlg.
Assertion #1 - DEVMODE/DEVNAME structures should always be HGLOBALs when interacting with PrintDlg/PrintDlgEx methods per the documentation.
Question #1: Is it OK for me to cache that in my client as HGLOBAL?  Or should I copy to local memory after calls and then copy back to HGLOBAL before showing again? Seems if I global lock, then I could just hang onto the HGLOBAL and save me some
steps.
Assertion #2 - PrintDlg/PrintDlgEx (and associated structs) state that the memory for hDevMode/hDevNames are changed on input and output.  In my questions/code, we are always passing in a DEVMODE/DEVNAMEs structure.
Question #2 - So, does that mean that I should always assume that I am getting back a different HGLOBAL after the call?  Meaning I should lock/cache the copy that comes back and not assume it was the same HGLOBAL I passed in?  Or does it just mean
that the content of the memory I provided in may be different?
Question #3 - If the user cancels the operation, does that mean the PrintDlg/PrintDlgEx method has freed the memory I passed into the method?  That would mean to me that I need to keep a copy of the DEVMODE/DEVANME before passing it in, just for the
sole purpose of the user canceling.  My DEVMODE/DEVNAME might be custom in my app (landscape/portrait) at that point and I don't want to lose the user's customizations.
Overall Flow
Here is the overall flow that I am using and I am curious to know if the flow is correct
At start of my app, get the DEVMODE/DEVNAMES for the default printer using PrintDlg with flags PD_RETURNDEFAULT | PD_RETURNDC.  I call GlobalLock for both DEVMODE/DEVNAME into a class member HGLOBAL.  I do not free the memory at this point as
I want to cache the DEVMODE/DEVNAME associated with the printer DC.
If the user selects print, I call GlobalUnlock on my cached HGLOBALS and assign them to the PRINTDLGEX.hDevMode and hDevNames members.  Then I call PrintDlgEx.
Assuming the user presses the 'OK/Apply' button, I then lock the PRINTDLGEX.hDevMode and hDevNames parameters using GlobalLock
Assuming the user presses 'Cancel', I lock my previous member (Has PrintDlgEx released this memory?).
The code repeats this process over the lifetime of the application. 
I also pass these DEVMODE and DEVNAME structures to PageSetupDlg so that the user can customize the output.  I use the exact same process of unlock/lock before and after. 
I realize this is a lot of questions, but I can't seem to find an overall guide to managing DEVMODEs/DEVNAMEs in a situation like this where an app caches locally the changes the user makes in the printer setup and page setup.
I guess my most important question is what do PrintDlg/PrintDlgEx do to the DEVMODE/DEVNAME when the user presses cancel.  This looks like a change I may have to make in my application.
Thanks a ton!
Brian R
Brian R.

Hi Brian R,
>>My problem is that I have been unable to find examples that show examples that start with these structures before calls to PrintDlg.
Here are some PrintDlg sample for you reference:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646829(v=vs.85).aspx
If the function returns TRUE, the function uses these members to return handles to 
DEVNAMES structures containing the user input and information about the printer. You can use this information to prepare the output to be sent to the selected printer.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646942(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646844(v=vs.85).aspx
>>Question #3
The user clicked the Cancel button. The information in the
PRINTDLGEX structure is unchanged.
Regards,

Similar Messages

  • Delete the warehouse management view and archive before deleting.

    Hi All,
    I have requirement like this where I need to delete the warehouse management view from about 40k records
    also need to archive the materials in order for the views to truly be deleted, instead of just marked for deletion.
    Could you please help me in proceeding with this.
    Thanks,
    Reddy

    Hi,
    in this way which I described you will delete the warehouse managment view for the material ( after that your material will no longer exist for that warehouse management organization data, but the other organization data for the material will exist). It's depend on where you are going to set the deletion flag for the material in MM06 before Archiving/Deletion with MM71
    Regards Vassko!

  • [SOLVED]Network Manager Applet and nmcli failing after GCC upgrade

    Hi All,
    So I went to update my system today and there were only like 8 or 9 updates. Like many other people I had an issue with gcc and pacman. To fix this I ran
    pacman -S gcc
    Then I ran:
    pacman -Su
    which updated pacman itself. On reboot though I noticed network manager applet was unable to find any of my network devices despite the fact that network manager was running and I had an IP address. I killed nm-applet and re-ran it and it spewed errors about not being able to connect to network manager. I tried running nmcli and it did the same thing. However, when I run nmcli as root it works. Looking at the arch wiki they suggest you be a part of the wheel and network group which I made sure I was. Everything was working up until I ran those two updates though. Anyone else have this happen or have any idea what is wrong?
    Thanks,
    Hemmar
    EDIT: Never mind - a patch was released for consolekit which fixes the problem.
    Last edited by hemmar (2012-04-13 00:36:49)

    Hi guz46
    I have already tried removing the ! and the same thing happened ... but I realised today that I was being automatically connected to "Auto eth0" despite there being no cable present. When automatic connection was disabled on "Auto eth0" my 3G connection (ppp0) connected fine.
    Could you clarify that the preferred set-up in the /etc/rc.conf for the interfaces is without the !. The Wiki for networkmanager says to disable them, but then states that some may need to be reenabled with no explanation. The purpose of this confuses me!
    Thanks for you help anyways,
    Scott
    EDIT:
    I appear to have fixed my problem with the auto connection on the various interfaces by updating my /etc/rc.conf file to:
    #Static IP example
    #eth0="dhcp"
    ppp0="dhcp"
    wlan0="dhcp"
    eth0="dhcp"
    INTERFACES=(ppp0 wlan0 eth0)
    Thus ensuring that I can connect in order of preference.
    Last edited by ScottArch (2009-11-03 18:48:47)

  • Grantor Managment solutions and BCS problem after technical upgrade.

    Hello every one,
    The current release SAP installation was upgraded to ECC 6.0; this was a technical upgrade and did not replace functionality such as "Former Budgeting" with the new BCS functionality.  SAP developed the Grantor Management solution utilizing BCS.  BCS utilizes a different table structure from the Former Budgeting functionality.  The current tables do not contain the BCS reference points to each other which limits the implementation of Grantor Management in the same instance. There are no plans to upgrade to BCS functionality at this point in time.
    what are my options? How can we work around this issue?
    Regards
    K

    Hi,
    Thanks for the resposnse.
    But when i go through the OSS notes it is provided that there will be performance problem in executing the report.
    How to get it solved?
    Thanks,
    Regards
    M.A

  • BUG Before/After Function stopped working after Convert Photo to DNG

    Hi,
    I just converted all my photos to DNG using Lightroom's Convert Photo to DNG function and the Before/After " \ " function (in Develop module) is not working anymore... same problem in Lightroom 3.0
    regards,
    Danny

    I processed a Nikon .nef raw file in Lightroom
    .  Then I went to the Library Module under
    Library and chose Convert to DNG.  After the conversion
    the complete history was still available.  However, the Before/After function using \ or Before/After Views did not work.  It was necessary to click on the History State to compare views.  Using the Before/After Views, the original could be compared to the processed view by clicking on the Import state.
    This will not be a problem if the files are converted to DNG during initial import.
    I also recommend backing up originals and all processed files along with the Lightroom database on a least two drives on location and another off-site.

  • Black boot screen and startup manager on mid 2014 rMBP after upgrading to Yosemite

    After upgrading to Yosemite I'm experiencing black booting process. Moreover, I noticed that the startup manager, which we access by holding the option key, has the black background too. I didn't like the Yosemite, so I downgraded back to Mavericks, but I still have the startup manager with the black background and the initial screen during the startup sound is black too, and after that the grey screen with the Apple logo comes up, which is typical for Mavericks. I want my startup manager to have the grey background as before. And also, before there was the grey screen during the startup sound, not the black one. How to revert all this to the previous state? I'm experiencing all this on my rMBP, 13-inch, mid-2014.
    I want to revert because after downgrading back to Mavericks my rMBP started freezing terribly, especially on youtube, ebay and app store. And it's not just the web browsing, it's freezing when navigating in finder too. I know there are many experienced users here, so I hope that somebody can help me with this. Before upgrading to Yosemite my machine was running flawlessly.

    nobody?

  • Grey songs appear after managing music, and seemed to be unplayable/lost. Videos lost as well. How do i retrieve them?

    After doing some actions with my iPod Touch 4G, ALL my music AND video library turned grey, or rather, after pressing the Music app, I received the message, along the lines of "There is no music." This is on my Mac laptop with an older version of itunes, my main music is however backed up on my desktop Mac.
    Actions and settings that i took which may have caused the grey-out or loss of my music and videos.
    1. Manually manage music and videos.
    2. Unchecked and rechecked a song, out of sheer interest (this may be the problem) whilst on my laptop
    3. Managing files inside the iPod, using another desktop application whilst the iPod was in my laptop.
    The situation
    All music appeared grey in my iPod
    Majority of VIDEOS LOST.
    Retrieved most of MY music from my Home Mac via iTunes auto-sync
    Friend's music is LOST (greyed out and unplayable in iTunes)
    My attempts to retrieve lost music and videos:
    1. Removed my iPod from laptop and attached my iPod to my desktop Mac, and it automatically synced, retrieving the music i had. The music my friend had recently lent me, that is, put in my iPod via his iTunes on PC APPEARS TO HAVE BEEN LOST. My music is in black font on the iPod, but the music my friend had gave me is in light grey/gray font.
    Where did this video and music go? Did i delete the music and videos?

    Photos/videos in the Camera Roll are not synced. Photos/videos in the Camera Roll are not touched with the iTunes sync process. Photos/videos in the Camera Roll can be imported by your computer which is not handled by iTunes. Most importing software includes an option to delete the photos/videos from the Camera Roll after the import process is complete. If is my understanding that some Windows import software supports importing photos from the Camera Roll, but not videos. Regardless, the import software should not delete the photos/videos from the Camera Roll unless you set the app to do so.
    Photos/videos in the Camera Roll are included with your iPhone's backup. If you synced your iPhone with iTunes before the videos on the Camera Roll went missing and you haven't synced your iPhone with iTunes since they went missing, you can try restoring the iPhone with iTunes from the iPhone's backup. Don't sync the iPhone with iTunes again and decline the prompt to update the iPhone's backup after selecting Restore.

  • Delivery not before date and Delivery not after date

    Hi Everyone,
    Can anyone help me in this issue, we need to map "delivery not before date" and "delivery not after date" from an EDI 850 into a sales order.
    Are there any fields to which we can map the data? if not would anyone suggest how to go about it?
    Thanks,
    Michelle.

    Michelle,
    We have a similar requirement, albeit we call it a Delivery Window. We have implemented this by mapping two E1EDK03 qualifiers (we use 033 & 034) to two Z fields extended to VBAK, which we then include in our Sales Order Delivery Date logic.
    Not very elegant, but then my understanding is that SAP has no concept of the Delivery Window.
    Cheers, Paul.

  • How to change number of retries and delay before retrying after software install failure

    I deploy a software to client, but the installation is fail, so it will retry. but How to change the number of retries and delay before retrying after software install failure?
    I find "Retry Settings" in "Software Distribution Component Properties". But I think it work for Distribution, not the installation. am I right?

    First, are you referring to packages or applications because the behavior is different.
    Also, why do you want it to retry a failure? It failed for a reason so you need to fix the cause of the failure first. If it failed the first, it will likely fail the next time for the same reason. In general, ConfigMgr will only retry on transient type
    errors.
    Jason | http://blog.configmgrftw.com

  • Hi, Just switched from CS6 to PS CC. I am used to using ACR in CS6 with it's preview checkbox in the upper  right-hand corner. I do not see that checkbox in PS CC. I see that they have added side-by-side, right and left and top and bottom before and after

    Hi,
    Just switched from CS6 to PS CC. I am very comfortable using ACR in previous versions. I liked to use the preview checkbox located in the upper right-hand corner to see before and afters. That checkbox is no longer in my version of PS CC. I see that they have side-by-side, top and bottom and right and left before and after options in the lower right-hand corner in this version. Is there anyway to get that legacy preview checkbox back so that I can use it?

    Hi Warunicorn,
    Thank you very much. I just could not find it on my own. I will have more questions as I get into it.
    Jim

  • I copied message to SMS field and sent. After that the message still exist all the time in the SMS field. When I open the application I must always first delete the "saved"  ones before I write the new one. What to do to finally/definitely delete the save

    I copied message to SMS field and sent. After that the message still exist all the time in the SMS field. When I open the application I must always first delete the “saved”  ones before I write the new one. What to do to finally/definitely delete the save message?

    sorry it's ios6

  • Movie playlist in iTunes is not showing up on iPhone after manually managing syncing and including movies from playlist.

    Movie playlist in iTunes is not showing up on iPhone after manually managing syncing and including movies from playlist.

    Thank you.  This solved my problem too.
    But, one little thing to share:
    "There's an option in settings for Playlists. It was set to Music only. Changed that to All then found the movie playlist under Movies by selecting Genre."
    This is not to be done in iTunes in your computer; this is to be done at your apple TV under "setting". "audio video" "show playlist" "music only/all"
    I am posting this here because I started chat mode with Apple support last night at midnight till 1:30, they didn't know what to do.
    They called me back this morning at 10 am.
    It's not 11:40 they finally know what I am talking about and showed me where to to find the "music only / all" toggle.  My problem is now fixed;
    all these time, they have in front of them a screen shot of your questions and answer but they don't know where to change it from music only to all.
    So, I hope this will save the next victim a lot of time.
    Again, thank you.

  • "manually manage music and videos" setting disabled after upgrading iTunes!

    Hello every one.
    I used to manage my musics and videos manualy , so naturally "manually manage music and videos" check box was always "cheked"
    Now after i upgrade my itunes to latest version (11.1.3.8), i find out that option is "Unchecked"!!
    So i am not able to copy any music or video or book too my iphon !
    If i try to enable that option again, it will clear my libraries and i will lose anything.
    Why this happened? what can i do ? any workaround? seems like a bug to me. i didnt do anything just updated my itunes. that option was enabled on my iphone for like 3 years! now i just upgrade my iTunes and that check box is unchecked.
    It seems stupid itunes think its another machine and says " it is synced with another library"
    Any suggestion please?

    Yea, i managed to fix my issue in a wild fashion way But I DONT suggest it to anyone.
    I like to hear why it happened after upgrading iTunes and if there is any peaceful solution.
    Bythe way, here is how i fixed it :
    1-i checked "manually manage music and videos" checkbox and clicked on "Sync" button
    2-It showed a threating message that it will erase my music and videos ,......
    3-I clicked on OK button and let iTunes do any thing she said , but the second it started to delete my treasures from my iphone, i disconnected my phone by pulling USB cable.
    Now i have my musics and videos untouched and got that Option enabled again and i can manage my Music/Videos and Books manually.

  • Error HTTP Status 500 after installing DS Management Console and IPS Services on BI Enterprise Server

    The following error
    HTTP Status 500 - while trying to invoke the method java.util.Properties.entrySet() of an object loaded from local variable 'globalProperties'
    occurred after installing DS Management Console and IPS Services on BI Enterprise Server
    BI Enterprise Edition 4.1 SP1 and BODS 4.1 SP1

    Hi,
    If you can't see the login screen of the CMC then it's a problem of webapps and not EIM services.
    Try cleaning the Tomcat cache for the BOE webapps and let Tomcat re cache it.  Often it does the job.
    - Stop Tomcat
    - Rename the BOE folder to BOE-OLD in C:\Program Files (x86)\SAP BusinessObjects\tomcat\work\Catalina\localhost\
    - Start Tomcat
    When the Tomcat process in task manager is done working (it can take 10-20 min+) then try again.
    When you're done, you can delete the BOE-OLD folder.
    Let me know!

  • Hi. I just wanted to update my 3 apps PS, Brigde and Indesign. After doing that I wasn't ablle to open Brigde??? PS and Indesign works fine. Further more the Application Manager does not seem to register the updates I have made. Everytime I open the compu

    Hi. I just wanted to update my 3 apps PS, Brigde and Indesign. After doing that I wasn't abble to open Brigde??? PS and Indesign works fine. Further more the Application Manager does not seem to register the updates I have made on Indesign and PS. Everytime I open the computer MacIBook 4.1, OS 10.6.7) it looks like I haven't updated software? Please help! Kurt

    Moving this discussion to the Bridge General Discussion forum.
    Kurt Rodahl Hoppe I would recommend reviewing Updates repeatedly applied | CC which discusses how to apply the updates successfully.

Maybe you are looking for

  • How do I exit a procedure without exiting the program?

    I just want to exit a procedure so that I do not execute the rest of the code below the point of where I would like to exit the procedure. Is there anyway I can do this?

  • Bounding box on graphic

    Hi you'all. Anyone know how to place a bounding box around a graphic? Thanks. Richard

  • IWeb Publish Success - Finally

    I have blasted my anger at Apple all over these boards and elsewhere over the debacle that iWeb has been everytime it is updated, and the continuing quality problems with the software. Upload has been a less than "it just works" experience, as indica

  • CSS fonts doesn't show in Design view

    Previously had DW 8 and had no problems. I installed CS3 yesterdayt and now any page I open only shows the text in Times New Roman. No other formatting like bold/italic shows. I can apply the formatting and when I view the file in a browser it shows.

  • Code Isnpector Issues

    Hi Appreciate your help on these two code inspector errors 1. NO CHECK or IF SY-TFILL > 0 preceeding SELECT...FOR ALL ENTRIES was found in line SELECT docnum countr stapa1 stapa2 stapa3 stapa4 stamid stamno          FROM edids INTO TABLE i_edids