|
Doh!
I was not thinking clearly. I just made some modifications to the sample code that was given. Besides it should not have been fsprintf (does this exist), it should have been fscanf.
INTP
|
|
|
|
|
i have a lot of questions about compliers
would U plz help me
in my case, it's tcc compiler, and i have to program an auto-grader for C language using C++.
and here are my Q.:
Can i convert a .exe compiler (tcc) to a .dll? How?
How can i get the output file from the (tcc) compiler
Where can i find the error codes or ID, so i can change the error messegs?
Thanx,
|
|
|
|
|
Hi,
What's exactly tcc compiler, I think you're using Turbo C++ ( or Borland C++ 3.1 or older ).
Well, There isn't anyway to use of that compiler to create your Dll.
TCC compilers are 16-bit and they have been made for Ms-Dos OS.
So, The short answer is NO.
But there's MANY ways to create your dll from your code.
Make new project in Visual C++ (Win32 Dynamic-Link Library project or MFC AppWizard Dll project) and then use of your old code !
hmm, perhaps you'll have to change some part of your code because of Dll structures, but you really don't need to change the main code.
Regards,
|
|
|
|
|
Hi,
Yeah i mean Turbo C++
do U know how to get the output files from it?
|
|
|
|
|
Hi there everyone. I am new to MFC application programming. I was just wondering how do i gray a submenu during runtime? For instance like Microsoft Visual C++, you'll need to open up a workspace before the File>Close Workspace will be active. Otherwise it will still stay grayed.
|
|
|
|
|
Try using the method EnableMenuItem() with nEnable set to MF_GRAYED.
From the docs:
=============================
CMenu::EnableMenuItem
UINT EnableMenuItem( UINT nIDEnableItem, UINT nEnable );
MF_GRAYED Disables the menu item so that it cannot be selected and dims it.
=============================
For this to work, you'll need to use CMenu classes for your menus and not just resource menus.
If you don't want to use CMenu, then you can gray menus by using the SDK call EnableMenuItem:
=============================
The EnableMenuItem function enables, disables, or grays the specified menu item.
BOOL EnableMenuItem(
HMENU hMenu, // handle to menu
UINT uIDEnableItem, // menu item to enable, disable, or gray
UINT uEnable // menu item flags
);
=============================
|
|
|
|
|
|
This is an unusual question, because MFC atomaticaly grays submenus until the use specifies a handler or explicitly says not to gray it. The question why is the menue item grayed is far more commond (a good thing). One of the great things about using MFC class wizard it that you do not need to know the details (although you should). When you bring up the class wizard it gives you a chance to specify a handler to use when you select an item (menu/button/etc..) as well as wheather it is enable or not.
INTP
|
|
|
|
|
What i try to say is that how do i gray a particular submenu when i press a button for instance. I know that in the properties, you could gray the submenu. But what i need is to gray the submenu during runtime.
|
|
|
|
|
The normal MFC way of enabling/disabling menu items during runtime is to implement the UPDATE_COMMAND_UI handler for the item.
To do this, use the class wizard to add an UPDATE_COMMAND_UI message handler for the particular menu item that you want to handle:
- On the "Message Maps" page, select the object id of the menu item that you want to control
- select the UPDATE_COMMAND_UI in the Messages window.
- Click on the "Add Function" button to add a handler for it.
- Click on the "Edit Code" button to goto the code for the newly added handler.
In the handler code, you can control whether the menu item is enabled or disabled as follows:
- To enable the menu item, call pCmdUI->Enable( TRUE );
- To disable the menu item, call pCmdUI->Enable( FALSE );
|
|
|
|
|
how could i draw an irregular dialog,for example, like the interface of winamp, according to an image basing on SDI, MDI or Dialog?
could anyone show me a detail step or some articles?
thanks
|
|
|
|
|
Check out,custom drawn button in the CP, i dont know exactly where it is,
There is one article that shows how to draw custom shape button depending upon the button image.
Dont be surprised that i asking you to look into button article, button is a window so it ur dialog, , you can get some inspiration from that article.
Prakash.
The World is getting smaller and so are the people.
|
|
|
|
|
There is more than one aticle on this subject at codeproject (SDI/MDI does not matter). My mind is blank at them moment of the details. One thing I do remmeber is that when you move the window it is nessesary to recalculate the position of the window (shape coordinates of the window/image).
Good luck!
INTP
|
|
|
|
|
SetWindowLong indicates blocked thread.
Hi,guys:
I got a problem and any response is much appreciated.
Environment: windows2000sp4,vc6sp5
92: LONG style = GetWindowLong(m_hwnd, GWL_STYLE);
93: style |= WS_DLGFRAME | WS_THICKFRAME;
94: SetWindowLong(m_hwnd, GWL_STYLE, style);
1000FD13 mov esi,esp
1000FD15 mov eax,dword ptr [ebp-8]
1000FD18 push eax
1000FD19 push 0F0h
1000FD1B mov ecx,dword ptr [ebp-4]
1000FD1E mov edx,dword ptr [ecx+194h]
1000FD24 push edx
1000FD25 call dword ptr [__imp__SetWindowLongA@12 (10090a28)]
1000FD2B cmp esi,esp
1000FD2D call __chkesp (1002cac0)
Everything is ok till
1000FD25 call dword ptr [__imp__SetWindowLongA@12 (10090a28)]
when single step debugging. The thread seems suspended at this line and never process any more.
How can I solve this problem ?
Thanks you very much !
|
|
|
|
|
I have used those lines of code before, i never had any problem with that,
just make sure that the window handle is valide.
The World is getting smaller and so are the people.
|
|
|
|
|
I am trying finish a class worthy of publishing at codeproject.
But I have run into a problem, loading a compressed image from file.
Does any one have an idea why this is failing?
hBitmap = CreateDIBSection(NULL, pInfo, DIB_RGB_COLORS, &pBits, NULL, 0);
Result: hBitmap = NULL
Last Error: The parameter is incorrect.
pInfo consist of the following (from debug dump):
BITMAPINFOHEADER:
{
Size = 40
Width = 800
Height = 600
Planes = 1
BitCount = 8
Compression = BI_RLE8
SizeImage = 267738
XPelsPerMeter = 0
YPelsPerMeter = 0
ClrUsed = 0
ClrImportant = 0
};
COLOR TABLE
{
000) 16, 16, 15
001) 18, 0E, 22
...
254) F4, F3, ED
255) F5, F4, F6
};
Note: I've not showing complete color-table from dump (it is correct).
Now here is what I know for a fact:
1) Incorrect parameter is pInfo.
2) The data dumped matches the data produced
by GetDIBits() when the bitmap was saved
to a disk file.
3) The "Paint" program that come with Windows has no
problem open and displaying the file.
I did experince a simular problem once before, that was an error on my part which made me say Da when I found it. But I see nothing wrong here and since the "Paint" can open it I assume (ass-u-me) that there is nothing wrong with the file.
INTP
|
|
|
|
|
Will your code open any bitmap file or is the problem only with 1 bitmap? Could the problem be related to compression?
|
|
|
|
|
Wow! That was quick I was answering some one elsese question at the time.
Yes it can onen any .bmp file, or at least it could.
It seems to be related to compressed bitmap files, but my code is written so that it will only save a bitmap file as compressed if the compressed data is small than the uncompressed data ( this alow prevent memory overrun ) and this was the only file that passed the test.
I would think that the DIB data produced by an sdk routine would be a valid parameter to anouther sdk routine. I am not supprised just fustrated.
If you are interested I am willing to send you the entire project file. Keep in mind that it is still in development, the ealier version where unexceptable (but could read a compessed DIB file).
INTP
|
|
|
|
|
John R. Shaw wrote:
If you are interested I am willing to send you the entire project file
I wouldn't mind taking a look at it - just get rid of all of the other project related routines that don't deal with opening/displaying the bitmaps (so that all extraneous possibilities are removed).
tlnolley@bj-consulting.com!
|
|
|
|
|
I'll send it to you shortly. This is a new machine and I need to download allzip first. This is the demo project I was going to submit (when complete) not the main project from which the class origanaly came from.
INTP
|
|
|
|
|
I want to modify document data (text) with the push of a button. I wonder how I can get to the document data programmatically "behind the scenes" -- and haven't found anything in the documentation that really tells how to do this.
I've considered using the document classes, the DocTemplate classes, view classes, and even trying to get to the document buffer directly, but none of what I've read has been clear about how to change the document data directly.
Help!
Thanks,
Lamar
|
|
|
|
|
A good part of the time, the reason that there is a lack of information is that those involded with producing the documentation consider it ovious. Unfortunaly that is not always the case.
Now assuming that you are using MFC document/view. There is more than one way to accomplish (what appears to be) you goal.
1) You can use the wizard to create a handler in the veiw class or the document class to handle what happens when you press a button (Actualy you could put the button handler in a number of places but only these 2 would be the proper).
2) If you place the button handler in the view class then you need to use GetDocument() to retreive a pointer to the document. If the button handler is in the document class you already have direct access to the data storage member.
3) Once you have a pointer/reference/direct access to the stored data then you can manipulate any way you like.
This all assumes that you have specified a document class member varaible to hold the loaded document. In the case you described I would assume (ass-u-me) that the file data is stored in a CString class or a CStringArray class.
No matter how the document was stored in memory (your choice), you have control of how it is modified.
INTP
|
|
|
|
|
aboutQ wrote:
I want to modify document data (text) with the push of a button. I wonder how I can get to the document data programmatically "behind the scenes"
Your document data must live somewhere in memory. Since you mention text, I assume it is stored as an array of CString objects.
You should be able to access your document's data by performing operations directly on the CString objects that contain your data.
What exactly is it that you are trying to do?
|
|
|
|
|
Hi all. I have a big problem with an application that when minimized and then restored it somewhat *crashses*. I think it is losing focus, but it seems like it just *quits* after displaying the dialog frame. It is active on the toolbar, but when clicked from the toolbar does not even try to redisplay itself.
This sounds a lot like some memory leak, but everything checks out. I am thinking it might be the heap size used because it does use a lot of dialogs from the MFC Class Wizard and a couple dozen icons. Perhaps it loses its focus because of the amount of items needed to reload? So the question would be, how to prevent it from *crashing* when restoring from the minimize state?
|
|
|
|
|
I have no idea what is going on, but one thing is clear. There is some thing seriously wrong with your code. If you are not using any kind of memory checker then you should download a trial copy of one of the memory checkers avialable online (I use Bounds checker) or use the memory tracking facilities that come with Visual C++ (is a pain to use and require modifing your code).
As for a more direct approach, just set a break point in your WM_SIZE message handle and step from there. If you do not have one, use the wizard to create one. This may or may not help you find the problem, because it is possible that the problem may have nothing to do with restoring but occured when you minimized the application (or even before that).
Good luck!
INTP
|
|
|
|