OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-02-2012, 18:49
longline
Guest
 
Posts: n/a
Default [CD12] VBA Macro works but hangs CD12

Hallo everybody!
First of all, please excuse me for my English, also please consider that I'm translating some terms from the Italian version of softwares...

I've written a long and complex VBA code for Corel Draw 12: its execution takes a very long time to be completed. While it runs, CorelDraw freezes and hangs, and in its title bar I can read "(Not responding)". However the code always succesfully complete its operations.

The problem is that this code is for people that maybe would force close CorelDraw without waiting this process to be terminated, thinking that everyting's blocked.

How can I prevent this not-responding state?

I have tried showing a MsgBox every 15 seconds. It says that everything's ok and asks for continuing. In this case the program freezes after about 9 secs, then after 6 the MsgBox pops up. It demonstrates that everything's ok, but this would be annoying: some executions could last for minutes!

Can you please give me any hint to solve? Please consider that I could also show a Form with some kind of messages.

Thank you!
Reply With Quote
  #2  
Old 07-02-2012, 00:35
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,790
Blog Entries: 13
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Not Responding

It is difficult to trouble shoot your problem without know what calls you are making, and what your code is doing. You could be stuck in a loop, or important some huge files, or files that have huge style lists. :-)

My suggestion is always to break down you code into small segments and speed test each part, hopefully this will help find the issue.

Once you are comfortable that the code is working efficiently, turn on Optimization to stop the screen refreshes.

-Shelby
Reply With Quote
  #3  
Old 07-02-2012, 03:32
longline
Guest
 
Posts: n/a
Default

Thank you for your answer!
I'm quite sure that my code is efficient: it has a very small amount of things to do, and it's really quick on simple handmade shapes. The problems come while dealing with the huge number of nodes of long texts converted to curves...

I don't know anything about "turning on Optimization", can you please tell me some more about it? Thank you!
Reply With Quote
  #4  
Old 07-02-2012, 12:30
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default try DoEvents

Try adding calls to DoEvents in your loops. This gives part of your time slice to windows so it can process messages.

-James
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #5  
Old 07-02-2012, 12:37
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,790
Blog Entries: 13
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Optimization

There are several items that can be turned on / off to improve performance, the biggest on is to turn off the screen redraws, this is done by:
Code:
Optimization = True
and turned back on:
Code:
Optimization = False
A more complete example of some of the others such as, PreserveSelection can be found here: screen redraw off/on
Hopefully that will help,

-Shelby
Reply With Quote
  #6  
Old 07-02-2012, 18:03
longline
Guest
 
Posts: n/a
Default

WOW! Both hints work great!

Do Events does prevent from "Not responding", and Optimization speeds the routine up!

Great! Thank you both very much!

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendkeys Test with CD12 knowbodynow CorelDRAW/Corel DESIGNER VBA 1 18-06-2010 09:47
Straightening Text in CD12 knowbodynow CorelDRAW/Corel DESIGNER VBA 2 03-03-2006 09:41
CD12 Thumbnailer chrstn CorelDRAW/Corel DESIGNER VBA 1 17-10-2005 10:19
why looks print from AI9 another then from CD12 rudyj.zabijak CorelDRAW/Corel DESIGNER VBA 2 09-04-2005 16:10
CD12: Dialogbox joexx CorelDRAW/Corel DESIGNER VBA 4 04-03-2004 08:08


All times are GMT -5. The time now is 06:42.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com