|
I would guess that the m_pTask pointer doesn't point to a valid NewTaskInfo object. If that's the case, the this pointer on entry to the setSize function isn't valid, and the resulting m_cs member passed to the EnterCriticalSection function doesn't represent a valid critical section.
Software Zen: delete this;
|
|
|
|
|
I cannot remember how to implement the code in a program that I am writing over here, to check the machine to see if the correct amount of RAM is installed and available in order for my program to run.
Basically, what I am after is something such as this:
1. To check to see if there is enough memory for my program to run.
2. If there is not enough memory available, or installed for it to return with an error saying, "not enough memory, please upgrade your memory or close existing applications that are running".
3. Then close if the program can not be initialized.
I've done this with I believe, 7 lines of code previously. I am using Visual C++ 6.0 and Visual C++ .NET; rarely Visual C++ 4.0 -- but I think this could be used on all three of these suites.
I would greatly appreciate any help and response to this message and helping me out with my problem.
|
|
|
|
|
Try
GlobalMemoryStatus()
or
GlobalMemoryStatusEx()
Gero
|
|
|
|
|
I'm looking for something more along the lines of having the program check to see if there is a certain amount of RAM available, say I want the program to have 64 MB of ram available for it to run, it will -- otherwise, anything lesser it would terminate. I would like this to be hard coded; but I cannot remember it though. I'll check out what you sent me and see what I can get out of that.
|
|
|
|
|
The MEMORYSTATUS structure you pass to GlobalMemoryStatus() contains dwTotalPhys and dwAvailPhys. dwTotalPhys contains the total amount of physical RAM and dwAvailPhys should contain the amount of FREE physical RAM. You can also use dwMemoryLoad to query the memory load in percent.
Hope this helps,
Gero
|
|
|
|
|
i am writing a small program that uninstall a com server i wrote earlier.
cleaning the registry is no problem. The problem lies in the start menu. One item on my application's start menu is "Uninstall.exe".
launch "Uninstall.exe" cleans the registry. But how can it delete itself to remove all items from start menu?
do i have to put uninstall in a different directory besides start menu?
thanks.
norm
|
|
|
|
|
|
does "InstallShield" does UN-installation for you? I did read up a little on InstallShield. Didnt know that it does uninstallation for u...
I figured it's pretty simple matter of registering a server, a few entries in registry and copying a few files to the client machines.
anyway, INstallation is done.
It's UN-installation where i'm having problem now.
Thanks.
norm
|
|
|
|
|
|
anyway, my installer/uninstaller has just been completed =)
well, at least the beta version. the licening module is missing, but the baby is ready for beta testing.
since i am pretty much the guy responsible for this part, any suggestion will be greatly appreciated
as for licencing, it's pretty standard architecture. user enter a number at the installer. the installer writes the licence number (encrypted-symmetric key) in registry. Everytime the COM server runs, it loads a licence list from disk - content of which is also encrypted. Then the COM server compare the entry in registry (user entered it to registry earlier) and search the list and see if can find a match. if it does, bingo. if it doesnt, the COM server will refuse any call.
the one big problem is: u have a static licence list sitting on the disk drive. it's encrypted. but the fact that it's static means that at one point u may run out of licence number from the list.
thanks!
norm
|
|
|
|
|
Hi, new to the C++ language, and trying to write a small program that will allow for a number input and be able to tell if it is numeric or something else. IE input number 1 - will accept, input a letter B will bomb out. Got the if then statement, but cannot figure out the rest. If someone can give me a hit it would be appreciated!
Thanks a bunch.
|
|
|
|
|
|
Cool - I did not know that. I've been using isalpha and isalnum to figure it out.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
Cool - I did not know that. I've been using isalpha and isalnum to figure it out.
I am absolutely ecstatic and delighted about the fact that I now belong to that sparsely populated club of people who can lay claim to having taught Christian Graus something about the C/C++ run time library.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
*grin* It's not that sparse, especially when it comes to the C run time library.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Dear Everyone,
First of all,I would like to apologize for posting question
that may not be related to this forum.
I have been working on PocketPC email client software for quite
along time.Eventhough there are many examples on SMTP classes for Windows
(Visual C++) but until now, I still can't find a SMTP class for PocketPC(Embedded Visual C++ 3.0).Besides that, I heard that PockePC doesn't suppport
smtp feature.Is that true?However, there is a software which I think, uses smtp to send email.Please refer to
http://www.talksender.com/product/download/index.html
for details.
I am thinking of creating my own mailing software(just for sending only)
on PocketPC.Does anyone have any idea or suggestion on this topic?
I would be glad to hear anything for all of you.
Thanks you very much.
From Joji.
Joji
|
|
|
|
|
You can use sockets on the Pocket PC, and then you can also make a SMTP program, because it uses sockets to talk to a SMTP server.
If you don't wanna write all the SMTP stuff yourself, I guess that a lot of the samples you can find also works in eMbedded Visual C++.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I have a class which manages byte buffers and TCHAR buffers. The class has an Initialize method which is used to allocate a new buffer (or use an existing one of suffecient size) of bytes or TCHARs. The buffer it allocates is always at least as big as the size requested. What I want to do is insure that the buffer allocated is allocated page and byte aligned.
What is the page size for x86 platform? Is it 4K??? Is this the correct way to deal with this?
int CMyBuffer::Initialize(const long lRequestedSize)
{
int iReturn = NO_ERROR;
long lAllocSize = (lRequestedSize + (lRequestedSize % 4000));
.. bla bla bla ...
return iReturn;
}
|
|
|
|
|
The page size if usually 4KB, though you can get 4MB (8MB?) pages also.
The way you deal with this is often a combination of VirtualAlloc , and common sense.
Besides, your faulty assumption that 4KB == 4000 bytes displays you don't really know computers yet. I (in a friendly way) suggest you study some more binary arithmetics, and perhaps CS in general.
|
|
|
|
|
Mike Nordell wrote:
The page size if usually 4KB, though you can get 4MB (8MB?) pages also.
Is this true on x86 platforms? I thought page size was hardware determined and that Intel used a 4k size for all its processors. If this is not true, where can I find more info on this.
Mike Nordell wrote:
4KB == 4000
Oops! I was just typing in an example. I realize that 4k == 4048 er.no. 4096. (EDIT: Damn I'm sleep this evening.)
|
|
|
|
|
Matt Gullett wrote:
Is this true on x86 platforms?
Yes, otherwise I wouldn't have mentioned it.
For user-mode Win32 programs you can safely assume 4KB pages (trust me, it's been like this for a decade).
But e.g. NT 5.1 (WinXP) allegedly uses the larger pagesize (be it 4MB or 8MB or whatever it is) in particular cases (and I believe at the same time throwing everything what was known as R/O-protection of kernel code down the drain) for kernel-mode. This is however discussed at other sites (such as MSDN and its mag.).
|
|
|
|
|
Don't hard-code the size, but instead call GetSystemInfo() - one of the pieces of info you get is the page size.
--Mike--
"Adventure. Excitement. A Jedi craves not these things."
-- Silent Bob
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Perfect. Exactly what I was looking for.
Thanks.
Matt Gullett
|
|
|
|
|
I am having trouble sending a paste message to windows in visual studio, word and excel. Sending the wm_paste message seems to work on normal edit controls and rich edit controls but not these others.
I get the window with focus and send it a wm_paste message. Are these different type of window's, should i send them a ctrl-v message? If so how do i send that message, Send a wm_keydown for v, but how do i say the ctrl is pressed.
Thanks
Scott
|
|
|
|
|
I can send the keydown for v but my main question now is
How to set the state of the control key to be pressed when i send the keydown message?
Scott
|
|
|
|