|
I also understand that leap years should be taken into account as well being they occur every 4 years
IsLeap(LONG year) {
if ( ((year % 4) == 0) &&
(((year % 100) != 0) ||
((year % 400) == 0))) {
return TRUE;
}
else {
return FALSE;
}
}
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
|
What do the values in the lpdwFlags say after you call this function?
I have found that this function is mostly reliable. It will return true if you are connected to a LAN, and it will return TRUE if you are connected to the internet through a modem. But this does not tell you if your LAN is connected to the internet.
I am sure there are other issues if you are connected behind a proxy server, and I am not sure about your Gateway issue.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi.
I would like to create a unique icon for an Windows program via MFC. I have a few common questions.
First, what size(s) do the image file(s) have to be? How many images files are required? I remember reading a few weeks back that a program requires two images files for its icon.
Secondly, what format do you have to save the image file in order to import it directly to MFC's Resource Editor?
Thanks,
Kuphryn
|
|
|
|
|
In my app I have two icons. One of size 16x16 pixel and the other of size 32x32 pixel.
The best way to create icons is to use the software Microangelo with which you can generate icons and mouse cursors and probably more things...
Gero
|
|
|
|
|
Okay. Thanks.
If you made two sizes of one icon using Photoshop, how would you import the bitmaps into the resource editor? There is an option to import icons, but not bitmaps. Furthermore, what names do you need to name the icon such that it will replace the old MFC icons?
Kuphryn
|
|
|
|
|
If you do icons with Photoshop think about using Microangelo (http://www.impactsoft.com/). With this software you can import bitmaps and save them as icons or cursors.
I don't think that you can import bitmaps via Visual Studio directly and store them as icons.
Gero
|
|
|
|
|
i have a windows service exe i want it to be installed programatically how to do that?
i have created a setup wizerd which also contain that windows service exe.
i want windows service exe to be installed when setup wizered finish .
what setup i have to perform to do that?
Nish i have seen your example of N track setup file that will do that thing.plz help
if any body else could tell plzzzz
r00d0034@yahoo.com
|
|
|
|
|
Create a small exe and make your installer program run this exe at the end of the program setup. If you put this exe in the same directory as your service exe it'll be very easy to figure out the path to the service.
int WinMain(...)
{
...
CServiceHelper m_sh;
m_sh.SetServiceDisplayName("Your service description");
m_sh.SetServiceName("Your service name");
m_sh.SetServicePath(strPath);
m_sh.SetAutoStart(true);
m_sh.Create();
...
}
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
thanks for ur reply
plz one thing more.
i have created that setup wizered like u have created in
N track.i will created that exe too.
but i dont know how to make this installer program run this exe at the end of program setup?
plz tell.
again thanks a lot.
r00d0034@yahoo.com
|
|
|
|
|
To install a service, you generally use the InstalUtil.exe tool from the command line as:
InstalUtil svcname.exe
To install a service from a setup wizard (in VS.NET), you need to include a Custom Action in your wizard that executes on Commit when the wizard is run. (Take a look at the Custom Actions tab in a VS.NET setup project)
A Custom Action can execute an external .exe or a script. In the situation where you want to install a service, you could execute the InstallUtil in a script that is called as a custom action, or write a console application like the one below using the AssemblyInstaller class. The AssemblyInstaller loads an assembly, and runs all the installers in it.
To use the AssemblyInstaller, you need to include an Installer class in your service that registers your service.
There is not enough time for me to discuss all the details, but you may want to take a look at the AssemblyInstaller and the ServiceInstaller classes.
The following is the example given in the docs for the AssemblyInstaller class:
using System;
using System.Configuration.Install;
using System.Collections;
using System.Collections.Specialized;
class AssemblyInstaller_Example
{
static void Main()
{
IDictionary mySavedState = new Hashtable();
Console.WriteLine( "" );
try
{
// Set the commandline argument array for 'logfile'.
string[] commandLineOptions = new string[ 1 ] {"/LogFile=example.log"};
// Create an object of the 'AssemblyInstaller' class.
AssemblyInstaller myAssemblyInstaller = new
AssemblyInstaller( "MyAssembly.exe" , commandLineOptions );
myAssemblyInstaller.UseNewContext = true;
// Install the 'MyAssembly' assembly.
myAssemblyInstaller.Install( mySavedState );
// Commit the 'MyAssembly' assembly.
myAssemblyInstaller.Commit( mySavedState );
}
catch (ArgumentException)
{
}
catch (Exception e)
{
Console.WriteLine( e.Message );
}
}
}
To help you get started, an example Installer implementation will look something like this:
[RunInstallerAttribute(true)]
public class MyServiceInstaller : Installer
{
private ServiceInstaller _installer;
private ServiceProcessInstaller _processInstaller;
public MyServiceInstaller()
{
InstallServices();
}
public void InstallServices()
{
_processInstaller = new ServiceProcessInstaller();
_processInstaller.Password = null;
_processInstaller.Username = null;
_processInstaller.Account = ServiceAccount.LocalSystem;
Installers.Add(_processInstaller);
// Add each service to installer
_installer = new ServiceInstaller();
_installer.StartType = ServiceStartMode.Manual;
_installer.ServiceName = "YourServiceName";
_installer.DisplayName = "YourServiceDisplayName";
Installers.Add(_installer);
}
}
There may be typos above, but the intention is to point you to the right classes to use.
Gaul
Gaulles Technologies, Inc.
http://www.gaulles.com
|
|
|
|
|
if the software appears in add/remove program then i can go to registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
and look for uninstallString key.
but what is the rest of procedure to uninstall a software programatically?
i dont know how to get uninstallString key and how to run it in a program.can any body help me in this regard?
any example link where registry keys are used and run programatically. if u could provide i would be very thank full to you?
r00d0034@yahoo.com
|
|
|
|
|
Most installers will automatically create an uninstaller for you. If you want to give a short cut to that in your start menu folder, just locate the name of the uninstall executable. It might not even be an exe and might be in the msi uninstaller format.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
I was under the impression that underneath the uninstallString key, there were some other keys. For isntance, if your app is called (creatively) YourApp:
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\YourApp
should contain a string value named UninstallPath that contains a path to the uninstall executable.
I am not sure how programs installed via MSI do this - it may be different.
Of couse, this is dependent on the program's installer behaving correctly and putting the correct registry keys there in the first place.
"Time spent with cats is never wasted." - Colette
|
|
|
|
|
infect i never used registry and its keys in a program.
thats why i dont know how to get UninstallPath in a program and who to run registry keys in a program.
if u give a little bit syntex and methods that are used in this procedure i will be very thank full?
and helping link about how to use registry keys in a program and how to run it?
r00d0034@yahoo.com
|
|
|
|
|
There are Windows APIs to read registries, as well as some articles here on CodeProjet. Check out RegOpenKey in MSDN for starters. Basically, you open a registry key, and you can then get data from values. Then close the key when you're done.
(I'd post some code, but I'm at my home computer at the moment and don't have any code with me. )
"Time spent with cats is never wasted." - Colette
|
|
|
|
|
hi,
My questions are:
1. How to link a MFC DLL to an exe file with DEF file
2. How to export an function without use of header file
Thanks
Extreme programming. Do the No.1
|
|
|
|
|
http://www.codeproject.com/dll/ultimate_dll_header.asp[^]
Although it's not the focus of this article, it does have a little info on .DEF files... and also a comparison of the various ways to export functions from a DLL.
Hope this helps.
"Time spent with cats is never wasted." - Colette
|
|
|
|
|
Im developing an NDIS adapter driver, to pass standard TCP/IP traffic over a nonstandard medium, and am having problems with ICMP echo request/replies. With the driver set up on 2 machines (IPs 1.2.3.4 and 1.2.3.5), I can drop to a command prompt on 1.2.3.4 and ping 1.2.3.5. An ARP is given to my driver, which is sent to the broadcast address, and 1.2.3.5 sends an ARP reply back to 1.2.3.4. An ICMP echo request is then transmitted from 1.2.3.4 to 1.2.3.5, and it is sent through my driver to 1.2.3.5. It appears to be successful in transmission, as the packet is packaged up in an NDIS_PACKET, and sent up to NDIS, and NDIS calls my MiniportReturnPacket function, however 1.2.3.5 never generates an ICMP reply. I have verified that the IPs and subnet masks are set up correctly, and that even though Im using the same driver on both machines, the MAC address's are unique. Anyone have any ideas as to what could be wrong? Thanks in advance.
Jesse Rosalia
|
|
|
|
|
Hello,
i have a bitmap in my iPAQ and i want to send with socket; my code is
int nBmpsize;
char *szBuff;
GetObject("\\Windows\\Start Menu\\front2.bmp", sizeof(BITMAP), &bitmap);
nBmpsize = bitmap.bmWidth*bitmap.bmHeight;
szBuff = new char[nBmpsize];
memcpy((void*)szBuff, bitmap.bmBits, nBmpsize);
but i have some problem. Why?
|
|
|
|
|
'some problem' does not give us much to go on. for starters, try making it an unsigned char buffer, a char buffer has a maximum value of 127. What is GetObject ? Also, bitmap.bmWidth * bitmap.bmHeight will give you the number of bits in a word aligned, one bit image ( that has only two colours ). You need to multiply by your bit depth and you need to add a stride value to the width before multiplying. My articles on Image Processing show how to calculate stride.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
The GetObject function requires a HBITMAP handle rather than the path to where the image is found. In order to get a HBITMAP handle you will need to load the image into a bitmap object. If you simply want to send the bitmap to another computer via a socket, you do not even need to load the bitmap into a HBITMAP object. This is used for displaying and manipulating the bits of the image.
All that you will need to do is open the file where the image is located, read the file data into memory, then use that memory buffer to send your image across the socket.
Here is an example:
<br />
HANDLE hFile = ::CreateFile("\\Windows\\Start Menu\\front2.bmp", GENERIC_READ, NULL, OPEN_EXISTING, 0, 0);<br />
if (INVALID_HANDLE_VALUE == hFile)<br />
{<br />
}<br />
DWORD FileSize = ::GetFileSize(hFile, NULL);<br />
BYTE *pbBuffer = new BYTE[FileSize];<br />
if (!pbBuffer)<br />
{<br />
}<br />
::ReadFile(hFile, pbBuffer, FileSize, &Bytes, 0);<br />
After you execute that code, pbBuffer will contain all of the data in the bitmap file and you can use that to send it over the socket. After you send it you will need to call delete[] pbBuffer;
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
In your example nBmpsize size may be invalid - it does not take bit depth into account, along with line alignments that may also be the case. See articles in the Code Project's Bitmap section.
Regards,
Bartosz Bien
|
|
|
|
|
if I have an url is there any function that can help me get the hostname.
E.g from http://www.microsoft.com/anypage/anypage2.html
I would like to get only www.microsoft.com part.
I could not find such an API but maybe somone knows.
Thanks in advance.
Orcun
|
|
|
|
|
One solution is a string function or algorithm to extract the sub-string you want. Do you store it in a string object or is it an array?
For a string object, use the find() functions. For an array, you could use strstr() and the like.
Kuphryn
|
|
|
|